From 5af5e8c300237b790e88ba14815ba52621ef7357 Mon Sep 17 00:00:00 2001 From: Bolero-MURAKAMI Date: Sun, 8 Sep 2013 18:59:50 +0900 Subject: [PATCH] add doc: basic_string assign --- .../libs/array/array/operator-assign.txt | 9 +- .../libs/string/basic_string/assign.txt | 158 +++++++++ .../libs/string/basic_string/clear.txt | 34 ++ .../libs/string/basic_string/index.txt | 2 +- .../libs/string/basic_string/length.txt | 37 ++ .../libs/string/basic_string/resize.txt | 50 +++ docs/libs/array/array/operator-assign.html | 11 +- docs/libs/string/basic_string/assign.html | 328 ++++++++++++++++++ docs/libs/string/basic_string/back.html | 10 +- docs/libs/string/basic_string/clear.html | 172 +++++++++ docs/libs/string/basic_string/empty.html | 10 +- docs/libs/string/basic_string/index.html | 10 +- docs/libs/string/basic_string/length.html | 177 ++++++++++ docs/libs/string/basic_string/max_size.html | 20 +- docs/libs/string/basic_string/resize.html | 193 +++++++++++ docs/libs/string/basic_string/size.html | 10 +- docs/libs/string/basic_string/swap.html | 10 +- docs/searchindex.js | 2 +- source/libs/array/array/operator-assign.rst | 9 +- source/libs/string/basic_string/assign.rst | 158 +++++++++ source/libs/string/basic_string/clear.rst | 34 ++ source/libs/string/basic_string/index.rst | 2 +- source/libs/string/basic_string/length.rst | 37 ++ source/libs/string/basic_string/resize.rst | 50 +++ 24 files changed, 1489 insertions(+), 44 deletions(-) create mode 100644 docs/_sources/libs/string/basic_string/assign.txt create mode 100644 docs/_sources/libs/string/basic_string/clear.txt create mode 100644 docs/_sources/libs/string/basic_string/length.txt create mode 100644 docs/_sources/libs/string/basic_string/resize.txt create mode 100644 docs/libs/string/basic_string/assign.html create mode 100644 docs/libs/string/basic_string/clear.html create mode 100644 docs/libs/string/basic_string/length.html create mode 100644 docs/libs/string/basic_string/resize.html create mode 100644 source/libs/string/basic_string/assign.rst create mode 100644 source/libs/string/basic_string/clear.rst create mode 100644 source/libs/string/basic_string/length.rst create mode 100644 source/libs/string/basic_string/resize.rst diff --git a/docs/_sources/libs/array/array/operator-assign.txt b/docs/_sources/libs/array/array/operator-assign.txt index 9fc997c3..cbcf11ca 100644 --- a/docs/_sources/libs/array/array/operator-assign.txt +++ b/docs/_sources/libs/array/array/operator-assign.txt @@ -16,7 +16,9 @@ Interface Effects ======================================== -| ``std::copy(rhs.begin(), rhs.end(), begin())``, ``std::move(rhs.begin(), rhs.end(), begin())``. +| ``std::copy(rhs.begin(), rhs.end(), begin())``. +| or +| ``std::move(rhs.begin(), rhs.end(), begin())``. Returns ======================================== @@ -28,10 +30,13 @@ Examples .. sourcecode:: c++ #include + #include using namespace sprout; auto x = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; - x = array{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}}; + SPROUT_STATIC_CONSTEXPR auto y = array{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}}; + x = y; + SPROUT_ASSERT_MSG(x == y, "y is assigned to x."); Header ======================================== diff --git a/docs/_sources/libs/string/basic_string/assign.txt b/docs/_sources/libs/string/basic_string/assign.txt new file mode 100644 index 00000000..fa03d292 --- /dev/null +++ b/docs/_sources/libs/string/basic_string/assign.txt @@ -0,0 +1,158 @@ +.. _sprout-string-basic_string-assign: +############################################################################### +assign +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + basic_string& assign(basic_string const& str); + +Effects +======================================== + +| Equivalent to ``assign(str, 0, npos)``. + +Returns +======================================== + +| ``*this``. + +---- + +Interface +======================================== +.. sourcecode:: c++ + + template + basic_string& assign(basic_string const& str, size_type pos, size_type n); + +Requires +======================================== + +| ``pos <= str.size()``. + +Effects +======================================== + +| Determines the effective length rlen of the string to assign as the smaller of n and ``str.size() - pos`` and calls ``assign(str.data() + pos, rlen)``. + +Returns +======================================== + +| ``*this``. + +Throws +======================================== + +| std::out_of_range if ``pos > str.size()``. + +---- + +Interface +======================================== +.. sourcecode:: c++ + + basic_string& assign(value_type const* s, size_type n); + +Requires +======================================== + +| s points to an array of at least n elements of value_type. + +Effects +======================================== + +| Replaces the string controlled by *this with a string of length n whose elements are a copy of those pointed to by s. + +Returns +======================================== + +| ``*this``. + +Throws +======================================== + +| std::length_error if ``n > max_size()``. + +---- + +Interface +======================================== +.. sourcecode:: c++ + + basic_string& assign(value_type const* s); + +Requires +======================================== + +| s points to an array of at least ``traits_type::length(s) + 1`` elements of value_type. + +Effects +======================================== + +| Calls ``assign(s, traits_type::length(s))``. + +Returns +======================================== + +| ``*this``. + +---- + +Interface +======================================== +.. sourcecode:: c++ + + basic_string& assign(size_type n, value_type c); + +Effects +======================================== + +| Equivalent to ``assign(basic_string(n, c))``. + +Returns +======================================== + +| ``*this``. + +---- + +Interface +======================================== +.. sourcecode:: c++ + + template + basic_string& assign(InputIterator first, InputIterator last); + +Effects +======================================== + +| Equivalent to ``assign(basic_string(first, last))``. + +Returns +======================================== + +| ``*this``. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + using namespace sprout; + + 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."); + +Header +======================================== + +| ``sprout/string/string.hpp`` +| Convenience header: ``sprout/string.hpp`` + diff --git a/docs/_sources/libs/string/basic_string/clear.txt b/docs/_sources/libs/string/basic_string/clear.txt new file mode 100644 index 00000000..c8dea92a --- /dev/null +++ b/docs/_sources/libs/string/basic_string/clear.txt @@ -0,0 +1,34 @@ +.. _sprout-string-basic_string-clear: +############################################################################### +clear +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + void clear() SPROUT_NOEXCEPT; + +Effects +======================================== + +| Fill [begin,end) with value_type(), and set the 0 to length. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + using namespace sprout; + + auto x = string<8>("homuhomu"); + x.clear(); + SPROUT_ASSERT_MSG(x.size() == 0 && x == "", "string is cleared."); + +Header +======================================== + +| ``sprout/string/string.hpp`` +| Convenience header: ``sprout/string.hpp`` + diff --git a/docs/_sources/libs/string/basic_string/index.txt b/docs/_sources/libs/string/basic_string/index.txt index f7458371..f511a144 100644 --- a/docs/_sources/libs/string/basic_string/index.txt +++ b/docs/_sources/libs/string/basic_string/index.txt @@ -282,7 +282,7 @@ Interface of all SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT; void resize(size_type n, value_type c); void resize(size_type n); - void clear(); + void clear() SPROUT_NOEXCEPT; SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT; // element access: diff --git a/docs/_sources/libs/string/basic_string/length.txt b/docs/_sources/libs/string/basic_string/length.txt new file mode 100644 index 00000000..89df011e --- /dev/null +++ b/docs/_sources/libs/string/basic_string/length.txt @@ -0,0 +1,37 @@ +.. _sprout-string-basic_string-length: +############################################################################### +length +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + SPROUT_CONSTEXPR size_type length() const SPROUT_NOEXCEPT; + +Returns +======================================== + +| The number of elements contained in the string. + +Examples +======================================== +.. sourcecode:: c++ + + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = string<8>("homuhomu"); + static_assert(input.length() == 8, "input size is 8."); + +Complexity +======================================== + +| Recursive function invocations in *O(1)* (constant) depth. + +Header +======================================== + +| ``sprout/string/string.hpp`` +| Convenience header: ``sprout/string.hpp`` + diff --git a/docs/_sources/libs/string/basic_string/resize.txt b/docs/_sources/libs/string/basic_string/resize.txt new file mode 100644 index 00000000..b7530ce7 --- /dev/null +++ b/docs/_sources/libs/string/basic_string/resize.txt @@ -0,0 +1,50 @@ +.. _sprout-string-basic_string-resize: +############################################################################### +resize +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + void resize(size_type n, value_type c); + + void resize(size_type n); + +Requires +======================================== + +| ``n <= max_size()``. + +Effects +======================================== + +| Alters the length of the string designated by *this as follows: + * If ``n <= size()``, the function replaces the string designated by ``*this`` with a string of length n whose elements are a copy of the initial elements of the original string designated by ``*this``. + * If ``n > size()``, the function replaces the string designated by ``*this`` with a string of length n whose first size() elements are a copy of the original string designated by ``*this``, and whose remaining elements are all initialized to c. + +| Equivalent to ``resize(n, value_type())`` when there is no parameter c. + +Throws +======================================== + +| std::length_error if ``n > max_size()``. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + using namespace sprout; + + auto x = string<8>("homuhomu"); + x.resize(4); + SPROUT_ASSERT_MSG(x.size() == 4 && x == "homu", "string is resized to 4."); + +Header +======================================== + +| ``sprout/string/string.hpp`` +| Convenience header: ``sprout/string.hpp`` + diff --git a/docs/libs/array/array/operator-assign.html b/docs/libs/array/array/operator-assign.html index 9f59da12..4711a614 100644 --- a/docs/libs/array/array/operator-assign.html +++ b/docs/libs/array/array/operator-assign.html @@ -121,7 +121,11 @@

Effects

-
std::copy(rhs.begin(), rhs.end(), begin()), std::move(rhs.begin(), rhs.end(), begin()).
+
std::copy(rhs.begin(), rhs.end(), begin()).
+
or
+
+
std::move(rhs.begin(), rhs.end(), begin()).
+
@@ -133,10 +137,13 @@

Examples

#include <sprout/array.hpp>
+#include <sprout/assert.hpp>
 using namespace sprout;
 
 auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
-x = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
+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.");
 
diff --git a/docs/libs/string/basic_string/assign.html b/docs/libs/string/basic_string/assign.html new file mode 100644 index 00000000..589393dc --- /dev/null +++ b/docs/libs/string/basic_string/assign.html @@ -0,0 +1,328 @@ + + + + + + + + + + assign — Sprout 1.0 documentation + + + + + + + + + + + + + + + +
+
+

Table Of Contents

+ + +

Previous topic

+

back

+

Next topic

+

swap

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

assign

+
+

Interface

+
template<std::size_t N2>
+basic_string& assign(basic_string<T, N2, Traits> const& str);
+
+
+
+
+

Effects

+
+
Equivalent to assign(str, 0, npos).
+
+
+
+

Returns

+
+
*this.
+
+
+
+
+

Interface

+
template<std::size_t N2>
+basic_string& assign(basic_string<T, N2, Traits> const& str, size_type pos, size_type n);
+
+
+
+
+

Requires

+
+
pos <= str.size().
+
+
+
+

Effects

+
+
Determines the effective length rlen of the string to assign as the smaller of n and str.size() - pos and calls assign(str.data() + pos, rlen).
+
+
+
+

Returns

+
+
*this.
+
+
+
+

Throws

+
+
std::out_of_range if pos > str.size().
+
+
+
+
+

Interface

+
basic_string& assign(value_type const* s, size_type n);
+
+
+
+
+

Requires

+
+
s points to an array of at least n elements of value_type.
+
+
+
+

Effects

+
+
Replaces the string controlled by *this with a string of length n whose elements are a copy of those pointed to by s.
+
+
+
+

Returns

+
+
*this.
+
+
+
+

Throws

+
+
std::length_error if n > max_size().
+
+
+
+
+

Interface

+
basic_string& assign(value_type const* s);
+
+
+
+
+

Requires

+
+
s points to an array of at least traits_type::length(s) + 1 elements of value_type.
+
+
+
+

Effects

+
+
Calls assign(s, traits_type::length(s)).
+
+
+
+

Returns

+
+
*this.
+
+
+
+
+

Interface

+
basic_string& assign(size_type n, value_type c);
+
+
+
+
+

Effects

+
+
Equivalent to assign(basic_string(n, c)).
+
+
+
+

Returns

+
+
*this.
+
+
+
+
+

Interface

+
template<typename InputIterator>
+basic_string& assign(InputIterator first, InputIterator last);
+
+
+
+
+

Effects

+
+
Equivalent to assign(basic_string(first, last)).
+
+
+
+

Returns

+
+
*this.
+
+
+
+

Examples

+
#include <sprout/string.hpp>
+#include <sprout/assert.hpp>
+using namespace sprout;
+
+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.");
+
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/libs/string/basic_string/back.html b/docs/libs/string/basic_string/back.html index 25d714cf..4eac40dc 100644 --- a/docs/libs/string/basic_string/back.html +++ b/docs/libs/string/basic_string/back.html @@ -38,7 +38,7 @@ - + @@ -49,7 +49,7 @@ index
  • - next |
  • front

    Next topic

    -

    swap

    +

    assign

    This Page

    Previous topic

    -

    max_size

    +

    clear

    Next topic

    operator[]

    @@ -161,7 +161,7 @@ next |
  • - previous |
  • Sprout 1.0 documentation »
  • Libraries »
  • diff --git a/docs/libs/string/basic_string/index.html b/docs/libs/string/basic_string/index.html index 36a5cfa8..5df76783 100644 --- a/docs/libs/string/basic_string/index.html +++ b/docs/libs/string/basic_string/index.html @@ -282,16 +282,16 @@ convertible to pointer size   -length +length   max_size   -resize +resize   -clear +clear   empty @@ -341,7 +341,7 @@ convertible to pointer -assign +assign   swap @@ -562,7 +562,7 @@ convertible to pointer SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT; void resize(size_type n, value_type c); void resize(size_type n); - void clear(); + void clear() SPROUT_NOEXCEPT; SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT; // element access: diff --git a/docs/libs/string/basic_string/length.html b/docs/libs/string/basic_string/length.html new file mode 100644 index 00000000..b4b6a880 --- /dev/null +++ b/docs/libs/string/basic_string/length.html @@ -0,0 +1,177 @@ + + + + + + + + + + length — Sprout 1.0 documentation + + + + + + + + + + + + + + + +
    +
    +

    Table Of Contents

    + + +

    Previous topic

    +

    size

    +

    Next topic

    +

    max_size

    +

    This Page

    + + + +
    +
    + +
    +
    +
    +
    + +
    +

    length

    +
    +

    Interface

    +
    SPROUT_CONSTEXPR size_type length() const SPROUT_NOEXCEPT;
    +
    +
    +
    +
    +

    Returns

    +
    +
    The number of elements contained in the string.
    +
    +
    +
    +

    Examples

    +
    #include <sprout/string.hpp>
    +using namespace sprout;
    +
    +SPROUT_STATIC_CONSTEXPR auto input = string<8>("homuhomu");
    +static_assert(input.length() == 8, "input size is 8.");
    +
    +
    +
    +
    +

    Complexity

    +
    +
    Recursive function invocations in O(1) (constant) depth.
    +
    +
    + +
    + + +
    +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/docs/libs/string/basic_string/max_size.html b/docs/libs/string/basic_string/max_size.html index c6bc57a6..8adf2798 100644 --- a/docs/libs/string/basic_string/max_size.html +++ b/docs/libs/string/basic_string/max_size.html @@ -38,8 +38,8 @@ - - + +