mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-11-29 01:03:45 +00:00
fix Issue #49
This commit is contained in:
parent
350e883d35
commit
88ee58bcf4
80 changed files with 1547 additions and 164 deletions
|
@ -30,8 +30,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
x.assign(0);
|
||||
SPROUT_ASSERT_MSG(x[0] == 0, "filled with 0.");
|
||||
int main() {
|
||||
x.assign(0);
|
||||
SPROUT_ASSERT_MSG(x[0] == 0, "filled with 0.");
|
||||
}
|
||||
|
||||
.. sourcecode:: c++
|
||||
|
||||
|
|
|
@ -30,8 +30,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
x.fill(0);
|
||||
SPROUT_ASSERT_MSG(x[0] == 0, "filled with 0.");
|
||||
int main() {
|
||||
x.fill(0);
|
||||
SPROUT_ASSERT_MSG(x[0] == 0, "filled with 0.");
|
||||
}
|
||||
|
||||
.. sourcecode:: c++
|
||||
|
||||
|
|
|
@ -35,8 +35,10 @@ Examples
|
|||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto y = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
x = y;
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x = y;
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
|
@ -33,8 +33,8 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
using type = array<int, 10>;
|
||||
SPROUT_STATIC_CONSTEXPR auto size = std::tuple_size<type>::value;
|
||||
static_assert(size == 10, "tuple size of array is 10.");
|
||||
SPROUT_STATIC_CONSTEXPR auto n = std::tuple_size<type>::value;
|
||||
static_assert(n == 10, "tuple size of array is 10.");
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
|
@ -32,8 +32,10 @@ Examples
|
|||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
auto y = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x[0] = 10 && y[0] == 1, "each element are swapped.");
|
||||
int main() {
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x[0] == 10 && y[0] == 1, "each element are swapped.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -29,8 +29,10 @@ Examples
|
|||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
auto y = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
x.swap(y);
|
||||
SPROUT_ASSERT_MSG(x[0] == 10 && y[0] == 1, "each element are swapped.");
|
||||
int main() {
|
||||
x.swap(y);
|
||||
SPROUT_ASSERT_MSG(x[0] == 10 && y[0] == 1, "each element are swapped.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -40,8 +40,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
x.assign(y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x.assign(y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
----
|
||||
|
||||
|
|
|
@ -30,8 +30,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
x.assign(y);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x.assign(y);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
----
|
||||
|
||||
|
|
|
@ -23,8 +23,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = string<8>("homuhomu");
|
||||
x.clear();
|
||||
SPROUT_ASSERT_MSG(x.size() == 0 && x == "", "string is cleared.");
|
||||
int main() {
|
||||
x.clear();
|
||||
SPROUT_ASSERT_MSG(x.size() == 0 && x == "", "string is cleared.");
|
||||
}
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
66
docs/_sources/libs/string/basic_string/compare-iterator.txt
Normal file
66
docs/_sources/libs/string/basic_string/compare-iterator.txt
Normal file
|
@ -0,0 +1,66 @@
|
|||
.. _sprout-string-basic_string-compare-iterator:
|
||||
###############################################################################
|
||||
compare
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename StringConstIterator>
|
||||
SPROUT_CONSTEXPR int compare(StringConstIterator s) const;
|
||||
|
||||
Requires
|
||||
========================================
|
||||
|
||||
| ``std::is_same<StringConstIterator, const_iterator>::value || std::is_same<StringConstIterator, iterator>::value``.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``compare(basic_string(s))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename StringConstIterator>
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, StringConstIterator s) const;
|
||||
|
||||
Requires
|
||||
========================================
|
||||
|
||||
| ``std::is_same<StringConstIterator, const_iterator>::value || std::is_same<StringConstIterator, iterator>::value``.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos, n1).compare(basic_string(s))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename StringConstIterator>
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, StringConstIterator s, size_type n2) const;
|
||||
|
||||
Requires
|
||||
========================================
|
||||
|
||||
| ``std::is_same<StringConstIterator, const_iterator>::value || std::is_same<StringConstIterator, iterator>::value``.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos, n1).compare(basic_string(s, n2))``.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/string.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
111
docs/_sources/libs/string/basic_string/compare.txt
Normal file
111
docs/_sources/libs/string/basic_string/compare.txt
Normal file
|
@ -0,0 +1,111 @@
|
|||
.. _sprout-string-basic_string-compare:
|
||||
###############################################################################
|
||||
compare
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<std::size_t N2>
|
||||
SPROUT_CONSTEXPR int compare(basic_string<T, N2, Traits> const& str) const;
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Determines the effective length rlen of the strings to compare as the smallest of ``size()`` and ``str.size()``.
|
||||
| The function then compares the two strings by calling ``traits_type::compare(data(), str.data(), rlen)``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
SPROUT_STATIC_CONSTEXPR auto result = x.compare(y);
|
||||
static_assert(result < 0, "x is less than y.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
.. note::
|
||||
The current implementation is incomplete. *O(N)* (linear) depth.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<std::size_t N2>
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string<T, N2, Traits> const& str) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos1, n1).compare(str)``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<std::size_t N2>
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string<T, N2, Traits> const& str, size_type pos2, size_type n2) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos1, n1).compare(basic_string<T, N2, Traits>(str, pos2, n2))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR int compare(value_type const* s) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``compare(basic_string(s))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, value_type const* s) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos, n1).compare(basic_string(s))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, value_type const* s, size_type n2) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos, n1).compare(basic_string(s, n2))``.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/string.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
94
docs/_sources/libs/string/basic_string/find.txt
Normal file
94
docs/_sources/libs/string/basic_string/find.txt
Normal file
|
@ -0,0 +1,94 @@
|
|||
.. _sprout-string-basic_string-find:
|
||||
###############################################################################
|
||||
find
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<std::size_t N2>
|
||||
SPROUT_CONSTEXPR size_type find(basic_string<T, N2, Traits> const& str, size_type pos = 0) const SPROUT_NOEXCEPT;
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Determines the lowest position xpos, if possible, such that both of the following conditions obtain:
|
||||
|
||||
* ``pos <= xpos and xpos + str.size() <= size();``
|
||||
* ``traits_type::eq(at(xpos + I), str.at(I))`` for all elements I of the string controlled by str.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| xpos if the function can determine such a value for xpos. Otherwise, returns npos.
|
||||
|
||||
Remarks
|
||||
========================================
|
||||
|
||||
| Uses ``traits_type::eq()``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input = string<8>("madocchi");
|
||||
SPROUT_STATIC_CONSTEXPR auto result = input.find("cchi");
|
||||
static_assert(result == 4, "a found position is 4.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
.. note::
|
||||
The current implementation is incomplete. *O(N)* (linear) depth.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR size_type find(value_type const* s, size_type pos, size_type n) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
|
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR size_type find(value_type const* s, size_type pos = 0) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
|
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR size_type find(value_type c, size_type pos = 0) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
|
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/string.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
|
@ -35,8 +35,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
x = y.begin();
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x = y.begin();
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
|
@ -34,8 +34,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
x = y;
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x = y;
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
----
|
||||
|
||||
|
|
|
@ -39,8 +39,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = string<8>("homuhomu");
|
||||
x.resize(4);
|
||||
SPROUT_ASSERT_MSG(x.size() == 4 && x == "homu", "string is resized to 4.");
|
||||
int main() {
|
||||
x.resize(4);
|
||||
SPROUT_ASSERT_MSG(x.size() == 4 && x == "homu", "string is resized to 4.");
|
||||
}
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
|
@ -33,8 +33,8 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
using type = string<8>;
|
||||
SPROUT_STATIC_CONSTEXPR auto size = std::tuple_size<type>::value;
|
||||
static_assert(size == 8, "tuple size of string is 8.");
|
||||
SPROUT_STATIC_CONSTEXPR auto n = std::tuple_size<type>::value;
|
||||
static_assert(n == 8, "tuple size of string is 8.");
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
|
@ -32,8 +32,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
auto y = string<8>("madocchi");
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
|
||||
int main() {
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -29,8 +29,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
auto y = string<8>("madocchi");
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
|
||||
int main() {
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -24,8 +24,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = string<8>("homuhomu");;
|
||||
char_traits<char>::assign(x.begin(), 8, 'M');
|
||||
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
|
||||
int main() {
|
||||
char_traits<char>::assign(x.begin(), 8, 'M');
|
||||
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -23,8 +23,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
char x[] = "homuhomu";
|
||||
char_traits<char>::assign(x, 8, 'M');
|
||||
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
|
||||
int main() {
|
||||
char_traits<char>::assign(x, 8, 'M');
|
||||
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -24,8 +24,10 @@ Examples
|
|||
|
||||
char x = 'H';
|
||||
SPROUT_STATIC_CONSTEXPR char y = 'M';
|
||||
char_traits<char>::assign(x, y);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
char_traits<char>::assign(x, y);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -30,8 +30,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");;
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
char_traits<char>::copy(x.begin(), y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
int main() {
|
||||
char_traits<char>::copy(x.begin(), y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -29,8 +29,10 @@ Examples
|
|||
|
||||
char x[] = "homuhomu";
|
||||
SPROUT_STATIC_CONSTEXPR char const* y = "madocchi";
|
||||
char_traits<char>::copy(x, y, 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
int main() {
|
||||
char_traits<char>::copy(x, y, 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -26,8 +26,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");;
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
char_traits<char>::move(x.begin(), y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
int main() {
|
||||
char_traits<char>::move(x.begin(), y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -24,8 +24,10 @@ Examples
|
|||
|
||||
char x[] = "homuhomu";
|
||||
SPROUT_STATIC_CONSTEXPR char const* y = "madocchi";
|
||||
char_traits<char>::move(x, y, 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
int main() {
|
||||
char_traits<char>::move(x, y, 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -136,8 +136,10 @@
|
|||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">assign</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"filled with 0."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">assign</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"filled with 0."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/array.hpp></span>
|
||||
|
|
|
@ -136,8 +136,10 @@
|
|||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">fill</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"filled with 0."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">fill</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"filled with 0."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/array.hpp></span>
|
||||
|
|
|
@ -140,8 +140,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">10</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">}};</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">y</span><span class="p">;</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">y</span><span class="p">;</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -137,8 +137,8 @@
|
|||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="k">using</span> <span class="n">type</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">;</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">size</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple_size</span><span class="o"><</span><span class="n">type</span><span class="o">>::</span><span class="n">value</span><span class="p">;</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">size</span> <span class="o">==</span> <span class="mi">10</span><span class="p">,</span> <span class="s">"tuple size of array is 10."</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">n</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple_size</span><span class="o"><</span><span class="n">type</span><span class="o">>::</span><span class="n">value</span><span class="p">;</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">n</span> <span class="o">==</span> <span class="mi">10</span><span class="p">,</span> <span class="s">"tuple size of array is 10."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -137,8 +137,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">10</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">}};</span>
|
||||
<span class="n">swap</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mi">10</span> <span class="o">&&</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="s">"each element are swapped."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">swap</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">10</span> <span class="o">&&</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="s">"each element are swapped."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -135,8 +135,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">10</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">}};</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">swap</span><span class="p">(</span><span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">10</span> <span class="o">&&</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="s">"each element are swapped."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">swap</span><span class="p">(</span><span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">10</span> <span class="o">&&</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="s">"each element are swapped."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="basic_string" href="index.html" />
|
||||
<link rel="next" title="string" href="../string.html" />
|
||||
<link rel="next" title="compare" href="compare-iterator.html" />
|
||||
<link rel="prev" title="operator=" href="operator-assign-iterator.html" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../string.html" title="string"
|
||||
<a href="compare-iterator.html" title="compare"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="operator-assign-iterator.html" title="operator="
|
||||
|
@ -84,8 +84,8 @@
|
|||
<p class="topless"><a href="operator-assign-iterator.html"
|
||||
title="previous chapter">operator=</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../string.html"
|
||||
title="next chapter">string</a></p>
|
||||
<p class="topless"><a href="compare-iterator.html"
|
||||
title="next chapter">compare</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/string/basic_string/assign-iterator.txt"
|
||||
|
@ -153,8 +153,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">assign</span><span class="p">(</span><span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">assign</span><span class="p">(</span><span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -206,7 +208,7 @@
|
|||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../string.html" title="string"
|
||||
<a href="compare-iterator.html" title="compare"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="operator-assign-iterator.html" title="operator="
|
||||
|
|
|
@ -155,8 +155,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">assign</span><span class="p">(</span><span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">assign</span><span class="p">(</span><span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -126,8 +126,10 @@
|
|||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&&</span> <span class="n">x</span> <span class="o">==</span> <span class="s">""</span><span class="p">,</span> <span class="s">"string is cleared."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&&</span> <span class="n">x</span> <span class="o">==</span> <span class="s">""</span><span class="p">,</span> <span class="s">"string is cleared."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
213
docs/libs/string/basic_string/compare-iterator.html
Normal file
213
docs/libs/string/basic_string/compare-iterator.html
Normal file
|
@ -0,0 +1,213 @@
|
|||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript">
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-43764535-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
<title>compare — Sprout 1.0 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="basic_string" href="index.html" />
|
||||
<link rel="next" title="string" href="../string.html" />
|
||||
<link rel="prev" title="assign" href="assign-iterator.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../string.html" title="string"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="assign-iterator.html" title="assign"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
<li><a href="../index.html" >Sprout.String</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">basic_string</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">compare</a><ul>
|
||||
<li><a class="reference internal" href="#interface">Interface</a></li>
|
||||
<li><a class="reference internal" href="#requires">Requires</a></li>
|
||||
<li><a class="reference internal" href="#returns">Returns</a></li>
|
||||
<li><a class="reference internal" href="#id1">Interface</a></li>
|
||||
<li><a class="reference internal" href="#id2">Requires</a></li>
|
||||
<li><a class="reference internal" href="#id3">Returns</a></li>
|
||||
<li><a class="reference internal" href="#id4">Interface</a></li>
|
||||
<li><a class="reference internal" href="#id5">Requires</a></li>
|
||||
<li><a class="reference internal" href="#id6">Returns</a></li>
|
||||
<li><a class="reference internal" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="assign-iterator.html"
|
||||
title="previous chapter">assign</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../string.html"
|
||||
title="next chapter">string</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/string/basic_string/compare-iterator.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="compare">
|
||||
<h1>compare<a class="headerlink" href="#compare" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">StringConstIterator</span><span class="o">></span>
|
||||
<span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">StringConstIterator</span> <span class="n">s</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="requires">
|
||||
<h2>Requires<a class="headerlink" href="#requires" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">std::is_same<StringConstIterator,</span> <span class="pre">const_iterator>::value</span> <span class="pre">||</span> <span class="pre">std::is_same<StringConstIterator,</span> <span class="pre">iterator>::value</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">compare(basic_string(s))</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id1">
|
||||
<h2>Interface<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">StringConstIterator</span><span class="o">></span>
|
||||
<span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">size_type</span> <span class="n">pos1</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n1</span><span class="p">,</span> <span class="n">StringConstIterator</span> <span class="n">s</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id2">
|
||||
<h2>Requires<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">std::is_same<StringConstIterator,</span> <span class="pre">const_iterator>::value</span> <span class="pre">||</span> <span class="pre">std::is_same<StringConstIterator,</span> <span class="pre">iterator>::value</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<h2>Returns<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">basic_string(*this,</span> <span class="pre">pos,</span> <span class="pre">n1).compare(basic_string(s))</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id4">
|
||||
<h2>Interface<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">StringConstIterator</span><span class="o">></span>
|
||||
<span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">size_type</span> <span class="n">pos1</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n1</span><span class="p">,</span> <span class="n">StringConstIterator</span> <span class="n">s</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n2</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id5">
|
||||
<h2>Requires<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">std::is_same<StringConstIterator,</span> <span class="pre">const_iterator>::value</span> <span class="pre">||</span> <span class="pre">std::is_same<StringConstIterator,</span> <span class="pre">iterator>::value</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id6">
|
||||
<h2>Returns<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">basic_string(*this,</span> <span class="pre">pos,</span> <span class="pre">n1).compare(basic_string(s,</span> <span class="pre">n2))</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/string/string.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../string.html" title="string"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="assign-iterator.html" title="assign"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
<li><a href="../index.html" >Sprout.String</a> »</li>
|
||||
<li><a href="index.html" >basic_string</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
262
docs/libs/string/basic_string/compare.html
Normal file
262
docs/libs/string/basic_string/compare.html
Normal file
|
@ -0,0 +1,262 @@
|
|||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript">
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-43764535-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
<title>compare — Sprout 1.0 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="basic_string" href="index.html" />
|
||||
<link rel="next" title="operator std::basic_string" href="operator-std-basic_string.html" />
|
||||
<link rel="prev" title="substr" href="substr.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="operator-std-basic_string.html" title="operator std::basic_string"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="substr.html" title="substr"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
<li><a href="../index.html" >Sprout.String</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">basic_string</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">compare</a><ul>
|
||||
<li><a class="reference internal" href="#interface">Interface</a></li>
|
||||
<li><a class="reference internal" href="#effects">Effects</a></li>
|
||||
<li><a class="reference internal" href="#examples">Examples</a></li>
|
||||
<li><a class="reference internal" href="#complexity">Complexity</a></li>
|
||||
<li><a class="reference internal" href="#id1">Interface</a></li>
|
||||
<li><a class="reference internal" href="#returns">Returns</a></li>
|
||||
<li><a class="reference internal" href="#id2">Interface</a></li>
|
||||
<li><a class="reference internal" href="#id3">Returns</a></li>
|
||||
<li><a class="reference internal" href="#id4">Interface</a></li>
|
||||
<li><a class="reference internal" href="#id5">Returns</a></li>
|
||||
<li><a class="reference internal" href="#id6">Interface</a></li>
|
||||
<li><a class="reference internal" href="#id7">Returns</a></li>
|
||||
<li><a class="reference internal" href="#id8">Interface</a></li>
|
||||
<li><a class="reference internal" href="#id9">Returns</a></li>
|
||||
<li><a class="reference internal" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="substr.html"
|
||||
title="previous chapter">substr</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="operator-std-basic_string.html"
|
||||
title="next chapter">operator std::basic_string</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/string/basic_string/compare.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="compare">
|
||||
<h1>compare<a class="headerlink" href="#compare" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N2</span><span class="o">></span>
|
||||
<span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">basic_string</span><span class="o"><</span><span class="n">T</span><span class="p">,</span> <span class="n">N2</span><span class="p">,</span> <span class="n">Traits</span><span class="o">></span> <span class="k">const</span><span class="o">&</span> <span class="n">str</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="effects">
|
||||
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">Determines the effective length rlen of the strings to compare as the smallest of <tt class="docutils literal"><span class="pre">size()</span></tt> and <tt class="docutils literal"><span class="pre">str.size()</span></tt>.</div>
|
||||
<div class="line">The function then compares the two strings by calling <tt class="docutils literal"><span class="pre">traits_type::compare(data(),</span> <span class="pre">str.data(),</span> <span class="pre">rlen)</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/string.hpp></span>
|
||||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">x</span><span class="p">.</span><span class="n">compare</span><span class="p">(</span><span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o"><</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"x is less than y."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="complexity">
|
||||
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
|
||||
</div>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">The current implementation is incomplete. <em>O(N)</em> (linear) depth.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id1">
|
||||
<h2>Interface<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N2</span><span class="o">></span>
|
||||
<span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">size_type</span> <span class="n">pos1</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n1</span><span class="p">,</span> <span class="n">basic_string</span><span class="o"><</span><span class="n">T</span><span class="p">,</span> <span class="n">N2</span><span class="p">,</span> <span class="n">Traits</span><span class="o">></span> <span class="k">const</span><span class="o">&</span> <span class="n">str</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">basic_string(*this,</span> <span class="pre">pos1,</span> <span class="pre">n1).compare(str)</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id2">
|
||||
<h2>Interface<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N2</span><span class="o">></span>
|
||||
<span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">size_type</span> <span class="n">pos1</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n1</span><span class="p">,</span> <span class="n">basic_string</span><span class="o"><</span><span class="n">T</span><span class="p">,</span> <span class="n">N2</span><span class="p">,</span> <span class="n">Traits</span><span class="o">></span> <span class="k">const</span><span class="o">&</span> <span class="n">str</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">pos2</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n2</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<h2>Returns<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">basic_string(*this,</span> <span class="pre">pos1,</span> <span class="pre">n1).compare(basic_string<T,</span> <span class="pre">N2,</span> <span class="pre">Traits>(str,</span> <span class="pre">pos2,</span> <span class="pre">n2))</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id4">
|
||||
<h2>Interface<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">value_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id5">
|
||||
<h2>Returns<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">compare(basic_string(s))</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id6">
|
||||
<h2>Interface<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">size_type</span> <span class="n">pos1</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n1</span><span class="p">,</span> <span class="n">value_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id7">
|
||||
<h2>Returns<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">basic_string(*this,</span> <span class="pre">pos,</span> <span class="pre">n1).compare(basic_string(s))</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id8">
|
||||
<h2>Interface<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">size_type</span> <span class="n">pos1</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n1</span><span class="p">,</span> <span class="n">value_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n2</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id9">
|
||||
<h2>Returns<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">basic_string(*this,</span> <span class="pre">pos,</span> <span class="pre">n1).compare(basic_string(s,</span> <span class="pre">n2))</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/string/string.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="operator-std-basic_string.html" title="operator std::basic_string"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="substr.html" title="substr"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
<li><a href="../index.html" >Sprout.String</a> »</li>
|
||||
<li><a href="index.html" >basic_string</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -38,7 +38,7 @@
|
|||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="basic_string" href="index.html" />
|
||||
<link rel="next" title="substr" href="substr.html" />
|
||||
<link rel="next" title="find" href="find.html" />
|
||||
<link rel="prev" title="back" href="c_array.html" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="substr.html" title="substr"
|
||||
<a href="find.html" title="find"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="c_array.html" title="back"
|
||||
|
@ -78,8 +78,8 @@
|
|||
<p class="topless"><a href="c_array.html"
|
||||
title="previous chapter">back</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="substr.html"
|
||||
title="next chapter">substr</a></p>
|
||||
<p class="topless"><a href="find.html"
|
||||
title="next chapter">find</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/string/basic_string/data.txt"
|
||||
|
@ -160,7 +160,7 @@
|
|||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="substr.html" title="substr"
|
||||
<a href="find.html" title="find"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="c_array.html" title="back"
|
||||
|
|
246
docs/libs/string/basic_string/find.html
Normal file
246
docs/libs/string/basic_string/find.html
Normal file
|
@ -0,0 +1,246 @@
|
|||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript">
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-43764535-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
<title>find — Sprout 1.0 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="basic_string" href="index.html" />
|
||||
<link rel="next" title="substr" href="substr.html" />
|
||||
<link rel="prev" title="back" href="data.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="substr.html" title="substr"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="data.html" title="back"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
<li><a href="../index.html" >Sprout.String</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">basic_string</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">find</a><ul>
|
||||
<li><a class="reference internal" href="#interface">Interface</a></li>
|
||||
<li><a class="reference internal" href="#effects">Effects</a></li>
|
||||
<li><a class="reference internal" href="#returns">Returns</a></li>
|
||||
<li><a class="reference internal" href="#remarks">Remarks</a></li>
|
||||
<li><a class="reference internal" href="#examples">Examples</a></li>
|
||||
<li><a class="reference internal" href="#complexity">Complexity</a></li>
|
||||
<li><a class="reference internal" href="#id1">Interface</a></li>
|
||||
<li><a class="reference internal" href="#id2">Returns</a></li>
|
||||
<li><a class="reference internal" href="#id3">Interface</a></li>
|
||||
<li><a class="reference internal" href="#id4">Returns</a></li>
|
||||
<li><a class="reference internal" href="#id5">Interface</a></li>
|
||||
<li><a class="reference internal" href="#id6">Returns</a></li>
|
||||
<li><a class="reference internal" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="data.html"
|
||||
title="previous chapter">back</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="substr.html"
|
||||
title="next chapter">substr</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/string/basic_string/find.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="find">
|
||||
<h1>find<a class="headerlink" href="#find" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N2</span><span class="o">></span>
|
||||
<span class="n">SPROUT_CONSTEXPR</span> <span class="n">size_type</span> <span class="n">find</span><span class="p">(</span><span class="n">basic_string</span><span class="o"><</span><span class="n">T</span><span class="p">,</span> <span class="n">N2</span><span class="p">,</span> <span class="n">Traits</span><span class="o">></span> <span class="k">const</span><span class="o">&</span> <span class="n">str</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">pos</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="k">const</span> <span class="n">SPROUT_NOEXCEPT</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="effects">
|
||||
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">Determines the lowest position xpos, if possible, such that both of the following conditions obtain:</div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><tt class="docutils literal"><span class="pre">pos</span> <span class="pre"><=</span> <span class="pre">xpos</span> <span class="pre">and</span> <span class="pre">xpos</span> <span class="pre">+</span> <span class="pre">str.size()</span> <span class="pre"><=</span> <span class="pre">size();</span></tt></li>
|
||||
<li><tt class="docutils literal"><span class="pre">traits_type::eq(at(xpos</span> <span class="pre">+</span> <span class="pre">I),</span> <span class="pre">str.at(I))</span></tt> for all elements I of the string controlled by str.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">xpos if the function can determine such a value for xpos. Otherwise, returns npos.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="remarks">
|
||||
<h2>Remarks<a class="headerlink" href="#remarks" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">Uses <tt class="docutils literal"><span class="pre">traits_type::eq()</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/string.hpp></span>
|
||||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">input</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="s">"cchi"</span><span class="p">);</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o">==</span> <span class="mi">4</span><span class="p">,</span> <span class="s">"a found position is 4."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="complexity">
|
||||
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
|
||||
</div>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">The current implementation is incomplete. <em>O(N)</em> (linear) depth.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id1">
|
||||
<h2>Interface<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="n">SPROUT_CONSTEXPR</span> <span class="n">size_type</span> <span class="n">find</span><span class="p">(</span><span class="n">value_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">pos</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">n</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id2">
|
||||
<h2>Returns<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><br /></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id3">
|
||||
<h2>Interface<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="n">SPROUT_CONSTEXPR</span> <span class="n">size_type</span> <span class="n">find</span><span class="p">(</span><span class="n">value_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">pos</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id4">
|
||||
<h2>Returns<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><br /></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="id5">
|
||||
<h2>Interface<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="n">SPROUT_CONSTEXPR</span> <span class="n">size_type</span> <span class="n">find</span><span class="p">(</span><span class="n">value_type</span> <span class="n">c</span><span class="p">,</span> <span class="n">size_type</span> <span class="n">pos</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="k">const</span><span class="p">;</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id6">
|
||||
<h2>Returns<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><br /></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/string/string.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="substr.html" title="substr"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="data.html" title="back"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
<li><a href="../index.html" >Sprout.String</a> »</li>
|
||||
<li><a href="index.html" >basic_string</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -369,7 +369,7 @@ convertible to pointer</td>
|
|||
<tr class="row-odd"><td><a class="reference internal" href="c_array.html"><em>c_array</em></a></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">find</span></tt></td>
|
||||
<tr class="row-even"><td><a class="reference internal" href="find.html"><em>find</em></a></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><tt class="xref doc docutils literal"><span class="pre">rfind</span></tt></td>
|
||||
|
@ -390,7 +390,7 @@ convertible to pointer</td>
|
|||
<tr class="row-even"><td><a class="reference internal" href="substr.html"><em>substr</em></a></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><tt class="xref doc docutils literal"><span class="pre">compare</span></tt></td>
|
||||
<tr class="row-odd"><td><a class="reference internal" href="compare.html"><em>compare</em></a></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -484,7 +484,7 @@ convertible to pointer</td>
|
|||
<tr class="row-odd"><td><tt class="xref doc docutils literal"><span class="pre">find_last_not_of</span></tt></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">compare</span></tt></td>
|
||||
<tr class="row-even"><td><a class="reference internal" href="compare-iterator.html"><em>compare</em></a></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -142,8 +142,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -142,8 +142,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">y</span><span class="p">;</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">y</span><span class="p">;</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="basic_string" href="index.html" />
|
||||
<link rel="next" title="operator=" href="operator-assign-iterator.html" />
|
||||
<link rel="prev" title="substr" href="substr.html" />
|
||||
<link rel="prev" title="compare" href="compare.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
|
@ -52,7 +52,7 @@
|
|||
<a href="operator-assign-iterator.html" title="operator="
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="substr.html" title="substr"
|
||||
<a href="compare.html" title="compare"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
|
@ -74,8 +74,8 @@
|
|||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="substr.html"
|
||||
title="previous chapter">substr</a></p>
|
||||
<p class="topless"><a href="compare.html"
|
||||
title="previous chapter">compare</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="operator-assign-iterator.html"
|
||||
title="next chapter">operator=</a></p>
|
||||
|
@ -157,7 +157,7 @@
|
|||
<a href="operator-assign-iterator.html" title="operator="
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="substr.html" title="substr"
|
||||
<a href="compare.html" title="compare"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
|
|
|
@ -147,8 +147,10 @@
|
|||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">resize</span><span class="p">(</span><span class="mi">4</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">==</span> <span class="mi">4</span> <span class="o">&&</span> <span class="n">x</span> <span class="o">==</span> <span class="s">"homu"</span><span class="p">,</span> <span class="s">"string is resized to 4."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">x</span><span class="p">.</span><span class="n">resize</span><span class="p">(</span><span class="mi">4</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">==</span> <span class="mi">4</span> <span class="o">&&</span> <span class="n">x</span> <span class="o">==</span> <span class="s">"homu"</span><span class="p">,</span> <span class="s">"string is resized to 4."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -137,8 +137,8 @@
|
|||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="k">using</span> <span class="n">type</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">;</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">size</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple_size</span><span class="o"><</span><span class="n">type</span><span class="o">>::</span><span class="n">value</span><span class="p">;</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">size</span> <span class="o">==</span> <span class="mi">8</span><span class="p">,</span> <span class="s">"tuple size of string is 8."</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">n</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple_size</span><span class="o"><</span><span class="n">type</span><span class="o">>::</span><span class="n">value</span><span class="p">;</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">n</span> <span class="o">==</span> <span class="mi">8</span><span class="p">,</span> <span class="s">"tuple size of string is 8."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="basic_string" href="index.html" />
|
||||
<link rel="next" title="operator std::basic_string" href="operator-std-basic_string.html" />
|
||||
<link rel="prev" title="back" href="data.html" />
|
||||
<link rel="next" title="compare" href="compare.html" />
|
||||
<link rel="prev" title="find" href="find.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
|
@ -49,10 +49,10 @@
|
|||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="operator-std-basic_string.html" title="operator std::basic_string"
|
||||
<a href="compare.html" title="compare"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="data.html" title="back"
|
||||
<a href="find.html" title="find"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
|
@ -76,11 +76,11 @@
|
|||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="data.html"
|
||||
title="previous chapter">back</a></p>
|
||||
<p class="topless"><a href="find.html"
|
||||
title="previous chapter">find</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="operator-std-basic_string.html"
|
||||
title="next chapter">operator std::basic_string</a></p>
|
||||
<p class="topless"><a href="compare.html"
|
||||
title="next chapter">compare</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/string/basic_string/substr.txt"
|
||||
|
@ -167,10 +167,10 @@
|
|||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="operator-std-basic_string.html" title="operator std::basic_string"
|
||||
<a href="compare.html" title="compare"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="data.html" title="back"
|
||||
<a href="find.html" title="find"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Libraries</a> »</li>
|
||||
|
|
|
@ -137,8 +137,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);</span>
|
||||
<span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">swap</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="s">"madocchi"</span> <span class="o">&&</span> <span class="n">y</span> <span class="o">==</span> <span class="s">"homuhomu"</span><span class="p">,</span> <span class="s">"each element are swapped."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">swap</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="s">"madocchi"</span> <span class="o">&&</span> <span class="n">y</span> <span class="o">==</span> <span class="s">"homuhomu"</span><span class="p">,</span> <span class="s">"each element are swapped."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -135,8 +135,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);</span>
|
||||
<span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">swap</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="s">"madocchi"</span> <span class="o">&&</span> <span class="n">y</span> <span class="o">==</span> <span class="s">"homuhomu"</span><span class="p">,</span> <span class="s">"each element are swapped."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">swap</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="s">"madocchi"</span> <span class="o">&&</span> <span class="n">y</span> <span class="o">==</span> <span class="s">"homuhomu"</span><span class="p">,</span> <span class="s">"each element are swapped."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -128,8 +128,10 @@
|
|||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);;</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">assign</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">,</span> <span class="sc">'M'</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'M'</span><span class="p">,</span> <span class="s">"x is filled by M."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">assign</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">,</span> <span class="sc">'M'</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'M'</span><span class="p">,</span> <span class="s">"x is filled by M."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -127,8 +127,10 @@
|
|||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="kt">char</span> <span class="n">x</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"homuhomu"</span><span class="p">;</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">assign</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="sc">'M'</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'M'</span><span class="p">,</span> <span class="s">"x is filled by M."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">assign</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="sc">'M'</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'M'</span><span class="p">,</span> <span class="s">"x is filled by M."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -128,8 +128,10 @@
|
|||
|
||||
<span class="kt">char</span> <span class="n">x</span> <span class="o">=</span> <span class="sc">'H'</span><span class="p">;</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="kt">char</span> <span class="n">y</span> <span class="o">=</span> <span class="sc">'M'</span><span class="p">;</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">assign</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">assign</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">,</span> <span class="s">"y is assigned to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -136,8 +136,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);;</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">copy</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">"y is copied to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">copy</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">"y is copied to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -135,8 +135,10 @@
|
|||
|
||||
<span class="kt">char</span> <span class="n">x</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"homuhomu"</span><span class="p">;</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="kt">char</span> <span class="k">const</span><span class="o">*</span> <span class="n">y</span> <span class="o">=</span> <span class="s">"madocchi"</span><span class="p">;</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">copy</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">"y is copied to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">copy</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">"y is copied to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -130,8 +130,10 @@
|
|||
|
||||
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"homuhomu"</span><span class="p">);;</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o"><</span><span class="mi">8</span><span class="o">></span><span class="p">(</span><span class="s">"madocchi"</span><span class="p">);</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">move</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">"y is copied to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">move</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">"y is copied to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -128,8 +128,10 @@
|
|||
|
||||
<span class="kt">char</span> <span class="n">x</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"homuhomu"</span><span class="p">;</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="kt">char</span> <span class="k">const</span><span class="o">*</span> <span class="n">y</span> <span class="o">=</span> <span class="s">"madocchi"</span><span class="p">;</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">move</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">"y is copied to x."</span><span class="p">);</span>
|
||||
<span class="kt">int</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="n">char_traits</span><span class="o"><</span><span class="kt">char</span><span class="o">>::</span><span class="n">move</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="mi">8</span><span class="p">);</span>
|
||||
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">"y is copied to x."</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<link rel="top" title="Sprout 1.0 documentation" href="../../index.html" />
|
||||
<link rel="up" title="Sprout.String" href="index.html" />
|
||||
<link rel="next" title="wstring" href="wstring.html" />
|
||||
<link rel="prev" title="assign" href="basic_string/assign-iterator.html" />
|
||||
<link rel="prev" title="compare" href="basic_string/compare-iterator.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
|
@ -52,7 +52,7 @@
|
|||
<a href="wstring.html" title="wstring"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="basic_string/assign-iterator.html" title="assign"
|
||||
<a href="basic_string/compare-iterator.html" title="compare"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../index.html" >Libraries</a> »</li>
|
||||
|
@ -72,8 +72,8 @@
|
|||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="basic_string/assign-iterator.html"
|
||||
title="previous chapter">assign</a></p>
|
||||
<p class="topless"><a href="basic_string/compare-iterator.html"
|
||||
title="previous chapter">compare</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="wstring.html"
|
||||
title="next chapter">wstring</a></p>
|
||||
|
@ -148,7 +148,7 @@
|
|||
<a href="wstring.html" title="wstring"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="basic_string/assign-iterator.html" title="assign"
|
||||
<a href="basic_string/compare-iterator.html" title="compare"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../index.html">Sprout 1.0 documentation</a> »</li>
|
||||
<li><a href="../index.html" >Libraries</a> »</li>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -30,8 +30,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
x.assign(0);
|
||||
SPROUT_ASSERT_MSG(x[0] == 0, "filled with 0.");
|
||||
int main() {
|
||||
x.assign(0);
|
||||
SPROUT_ASSERT_MSG(x[0] == 0, "filled with 0.");
|
||||
}
|
||||
|
||||
.. sourcecode:: c++
|
||||
|
||||
|
|
|
@ -30,8 +30,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
x.fill(0);
|
||||
SPROUT_ASSERT_MSG(x[0] == 0, "filled with 0.");
|
||||
int main() {
|
||||
x.fill(0);
|
||||
SPROUT_ASSERT_MSG(x[0] == 0, "filled with 0.");
|
||||
}
|
||||
|
||||
.. sourcecode:: c++
|
||||
|
||||
|
|
|
@ -35,8 +35,10 @@ Examples
|
|||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto y = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
x = y;
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x = y;
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
|
@ -32,8 +32,10 @@ Examples
|
|||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
auto y = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x[0] == 10 && y[0] == 1, "each element are swapped.");
|
||||
int main() {
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x[0] == 10 && y[0] == 1, "each element are swapped.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -29,8 +29,10 @@ Examples
|
|||
|
||||
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
auto y = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
x.swap(y);
|
||||
SPROUT_ASSERT_MSG(x[0] == 10 && y[0] == 1, "each element are swapped.");
|
||||
int main() {
|
||||
x.swap(y);
|
||||
SPROUT_ASSERT_MSG(x[0] == 10 && y[0] == 1, "each element are swapped.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -40,8 +40,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
x.assign(y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x.assign(y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
----
|
||||
|
||||
|
|
|
@ -30,8 +30,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
x.assign(y);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x.assign(y);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
----
|
||||
|
||||
|
|
|
@ -23,8 +23,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = string<8>("homuhomu");
|
||||
x.clear();
|
||||
SPROUT_ASSERT_MSG(x.size() == 0 && x == "", "string is cleared.");
|
||||
int main() {
|
||||
x.clear();
|
||||
SPROUT_ASSERT_MSG(x.size() == 0 && x == "", "string is cleared.");
|
||||
}
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
66
source/libs/string/basic_string/compare-iterator.rst
Normal file
66
source/libs/string/basic_string/compare-iterator.rst
Normal file
|
@ -0,0 +1,66 @@
|
|||
.. _sprout-string-basic_string-compare-iterator:
|
||||
###############################################################################
|
||||
compare
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename StringConstIterator>
|
||||
SPROUT_CONSTEXPR int compare(StringConstIterator s) const;
|
||||
|
||||
Requires
|
||||
========================================
|
||||
|
||||
| ``std::is_same<StringConstIterator, const_iterator>::value || std::is_same<StringConstIterator, iterator>::value``.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``compare(basic_string(s))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename StringConstIterator>
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, StringConstIterator s) const;
|
||||
|
||||
Requires
|
||||
========================================
|
||||
|
||||
| ``std::is_same<StringConstIterator, const_iterator>::value || std::is_same<StringConstIterator, iterator>::value``.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos, n1).compare(basic_string(s))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename StringConstIterator>
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, StringConstIterator s, size_type n2) const;
|
||||
|
||||
Requires
|
||||
========================================
|
||||
|
||||
| ``std::is_same<StringConstIterator, const_iterator>::value || std::is_same<StringConstIterator, iterator>::value``.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos, n1).compare(basic_string(s, n2))``.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/string.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
111
source/libs/string/basic_string/compare.rst
Normal file
111
source/libs/string/basic_string/compare.rst
Normal file
|
@ -0,0 +1,111 @@
|
|||
.. _sprout-string-basic_string-compare:
|
||||
###############################################################################
|
||||
compare
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<std::size_t N2>
|
||||
SPROUT_CONSTEXPR int compare(basic_string<T, N2, Traits> const& str) const;
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Determines the effective length rlen of the strings to compare as the smallest of ``size()`` and ``str.size()``.
|
||||
| The function then compares the two strings by calling ``traits_type::compare(data(), str.data(), rlen)``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
SPROUT_STATIC_CONSTEXPR auto result = x.compare(y);
|
||||
static_assert(result < 0, "x is less than y.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
.. note::
|
||||
The current implementation is incomplete. *O(N)* (linear) depth.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<std::size_t N2>
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string<T, N2, Traits> const& str) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos1, n1).compare(str)``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<std::size_t N2>
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string<T, N2, Traits> const& str, size_type pos2, size_type n2) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos1, n1).compare(basic_string<T, N2, Traits>(str, pos2, n2))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR int compare(value_type const* s) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``compare(basic_string(s))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, value_type const* s) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos, n1).compare(basic_string(s))``.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, value_type const* s, size_type n2) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(*this, pos, n1).compare(basic_string(s, n2))``.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/string.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
94
source/libs/string/basic_string/find.rst
Normal file
94
source/libs/string/basic_string/find.rst
Normal file
|
@ -0,0 +1,94 @@
|
|||
.. _sprout-string-basic_string-find:
|
||||
###############################################################################
|
||||
find
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<std::size_t N2>
|
||||
SPROUT_CONSTEXPR size_type find(basic_string<T, N2, Traits> const& str, size_type pos = 0) const SPROUT_NOEXCEPT;
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Determines the lowest position xpos, if possible, such that both of the following conditions obtain:
|
||||
|
||||
* ``pos <= xpos and xpos + str.size() <= size();``
|
||||
* ``traits_type::eq(at(xpos + I), str.at(I))`` for all elements I of the string controlled by str.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| xpos if the function can determine such a value for xpos. Otherwise, returns npos.
|
||||
|
||||
Remarks
|
||||
========================================
|
||||
|
||||
| Uses ``traits_type::eq()``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input = string<8>("madocchi");
|
||||
SPROUT_STATIC_CONSTEXPR auto result = input.find("cchi");
|
||||
static_assert(result == 4, "a found position is 4.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
.. note::
|
||||
The current implementation is incomplete. *O(N)* (linear) depth.
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR size_type find(value_type const* s, size_type pos, size_type n) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
|
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR size_type find(value_type const* s, size_type pos = 0) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
|
|
||||
|
||||
----
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR size_type find(value_type c, size_type pos = 0) const;
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
|
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/string.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
|
@ -35,8 +35,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
x = y.begin();
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x = y.begin();
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
|
@ -34,8 +34,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
x = y;
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
x = y;
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
----
|
||||
|
||||
|
|
|
@ -39,8 +39,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = string<8>("homuhomu");
|
||||
x.resize(4);
|
||||
SPROUT_ASSERT_MSG(x.size() == 4 && x == "homu", "string is resized to 4.");
|
||||
int main() {
|
||||
x.resize(4);
|
||||
SPROUT_ASSERT_MSG(x.size() == 4 && x == "homu", "string is resized to 4.");
|
||||
}
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
|
@ -33,8 +33,8 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
using type = string<8>;
|
||||
SPROUT_STATIC_CONSTEXPR auto size = std::tuple_size<type>::value;
|
||||
static_assert(size == 8, "tuple size of string is 8.");
|
||||
SPROUT_STATIC_CONSTEXPR auto n = std::tuple_size<type>::value;
|
||||
static_assert(n == 8, "tuple size of string is 8.");
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
|
|
@ -32,8 +32,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
auto y = string<8>("madocchi");
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
|
||||
int main() {
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -29,8 +29,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");
|
||||
auto y = string<8>("madocchi");
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
|
||||
int main() {
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -24,8 +24,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
auto x = string<8>("homuhomu");;
|
||||
char_traits<char>::assign(x.begin(), 8, 'M');
|
||||
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
|
||||
int main() {
|
||||
char_traits<char>::assign(x.begin(), 8, 'M');
|
||||
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -23,8 +23,10 @@ Examples
|
|||
using namespace sprout;
|
||||
|
||||
char x[] = "homuhomu";
|
||||
char_traits<char>::assign(x, 8, 'M');
|
||||
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
|
||||
int main() {
|
||||
char_traits<char>::assign(x, 8, 'M');
|
||||
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -24,8 +24,10 @@ Examples
|
|||
|
||||
char x = 'H';
|
||||
SPROUT_STATIC_CONSTEXPR char y = 'M';
|
||||
char_traits<char>::assign(x, y);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
int main() {
|
||||
char_traits<char>::assign(x, y);
|
||||
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -30,8 +30,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");;
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
char_traits<char>::copy(x.begin(), y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
int main() {
|
||||
char_traits<char>::copy(x.begin(), y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -29,8 +29,10 @@ Examples
|
|||
|
||||
char x[] = "homuhomu";
|
||||
SPROUT_STATIC_CONSTEXPR char const* y = "madocchi";
|
||||
char_traits<char>::copy(x, y, 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
int main() {
|
||||
char_traits<char>::copy(x, y, 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -26,8 +26,10 @@ Examples
|
|||
|
||||
auto x = string<8>("homuhomu");;
|
||||
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
|
||||
char_traits<char>::move(x.begin(), y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
int main() {
|
||||
char_traits<char>::move(x.begin(), y.begin(), 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
|
@ -24,8 +24,10 @@ Examples
|
|||
|
||||
char x[] = "homuhomu";
|
||||
SPROUT_STATIC_CONSTEXPR char const* y = "madocchi";
|
||||
char_traits<char>::move(x, y, 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
int main() {
|
||||
char_traits<char>::move(x, y, 8);
|
||||
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
|
||||
}
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
|
Loading…
Reference in a new issue