add doc: char_traits string operations

This commit is contained in:
Bolero-MURAKAMI 2013-09-05 14:09:23 +09:00
parent b7d68b357d
commit 3107804d87
15 changed files with 797 additions and 14 deletions

View file

@ -0,0 +1,39 @@
.. _sprout-string-char_traits-assign-string:
###############################################################################
assign
###############################################################################
Interface
========================================
.. sourcecode:: c++
static char_type* assign(char_type* s, std::size_t n, char_type a);
Effects
========================================
| Equivalent to ``std::char_traits<Char>::assign(s, n, a)``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
char x[] = "homuhomu";
char_traits<char>::assign(x, 8, 'M');
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
Complexity
========================================
| linear.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,40 @@
.. _sprout-string-char_traits-copy:
###############################################################################
copy
###############################################################################
Interface
========================================
.. sourcecode:: c++
static char_type* copy(char_type* s1, char_type const* s2, std::size_t n);
Effects
========================================
| Equivalent to ``std::char_traits<Char>::copy(s1, s2, n)``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
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.");
Complexity
========================================
| linear.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -12,6 +12,9 @@ char_traits
compare
length
find
move
copy
assign-string
Interface
========================================

View file

@ -0,0 +1,40 @@
.. _sprout-string-char_traits-move:
###############################################################################
move
###############################################################################
Interface
========================================
.. sourcecode:: c++
static char_type* move(char_type* s1, char_type const* s2, std::size_t n);
Effects
========================================
| Equivalent to ``std::char_traits<Char>::move(s1, s2, n)``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
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.");
Complexity
========================================
| linear.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``