mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-16 15:14:13 +00:00
add doc: char_traits integer type operations
This commit is contained in:
parent
3107804d87
commit
0ef068c92b
24 changed files with 1362 additions and 31 deletions
39
source/libs/string/char_traits/eof.rst
Normal file
39
source/libs/string/char_traits/eof.rst
Normal file
|
@ -0,0 +1,39 @@
|
|||
.. _sprout-string-char_traits-eof:
|
||||
###############################################################################
|
||||
eof
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
static SPROUT_CONSTEXPR int_type eof() SPROUT_NOEXCEPT;
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Equivalent to ``std::char_traits<Char>::eof()``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
#include <cstdio>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR char x = char_traits<char>::eof();
|
||||
static_assert(x == EOF, "x is equivalent to EOF.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| constant.
|
||||
| Recursive function invocations in *O(1)* (constant) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/char_traits.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
40
source/libs/string/char_traits/eq_int_type.rst
Normal file
40
source/libs/string/char_traits/eq_int_type.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
.. _sprout-string-char_traits-eq_int_type:
|
||||
###############################################################################
|
||||
eq_int_type
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
static SPROUT_CONSTEXPR bool eq_int_type(int_type c1, int_type c2) SPROUT_NOEXCEPT;
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Equivalent to ``std::char_traits<Char>::eq_int_type(c1, c2)``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR int x = 'H';
|
||||
SPROUT_STATIC_CONSTEXPR int y = 'H';
|
||||
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::eq_int_type(x, y);
|
||||
static_assert(result, "x is equal to y.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| constant.
|
||||
| Recursive function invocations in *O(1)* (constant) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/char_traits.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
|
@ -7,7 +7,7 @@ char_traits
|
|||
:hidden:
|
||||
|
||||
assign
|
||||
rq
|
||||
eq
|
||||
lt
|
||||
compare
|
||||
length
|
||||
|
@ -15,6 +15,11 @@ char_traits
|
|||
move
|
||||
copy
|
||||
assign-string
|
||||
not_eof
|
||||
to_char_type
|
||||
to_int_type
|
||||
eq_int_type
|
||||
eof
|
||||
|
||||
Interface
|
||||
========================================
|
||||
|
|
39
source/libs/string/char_traits/not_eof.rst
Normal file
39
source/libs/string/char_traits/not_eof.rst
Normal file
|
@ -0,0 +1,39 @@
|
|||
.. _sprout-string-char_traits-not_eof:
|
||||
###############################################################################
|
||||
not_eof
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
static SPROUT_CONSTEXPR int_type not_eof(int_type c) SPROUT_NOEXCEPT;
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Equivalent to ``std::char_traits<Char>::not_eof(c)``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR char x = 'H';
|
||||
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::not_eof(x);
|
||||
static_assert(result, "x is not EOF.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| constant.
|
||||
| Recursive function invocations in *O(1)* (constant) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/char_traits.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
40
source/libs/string/char_traits/to_char_type.rst
Normal file
40
source/libs/string/char_traits/to_char_type.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
.. _sprout-string-char_traits-to_char_type:
|
||||
###############################################################################
|
||||
to_char_type
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
static SPROUT_CONSTEXPR char_type to_char_type(int_type c) SPROUT_NOEXCEPT;
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Equivalent to ``std::char_traits<Char>::to_char_type(c)``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR int x = 'H';
|
||||
SPROUT_STATIC_CONSTEXPR auto y = char_traits<char>::to_char_type(x);
|
||||
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::to_int_type(y);
|
||||
static_assert(char_traits<char>::eq_int_type(result, x), "a value that converted from x to char type and re-converted to int type is equal to the original x.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| constant.
|
||||
| Recursive function invocations in *O(1)* (constant) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/char_traits.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
40
source/libs/string/char_traits/to_int_type.rst
Normal file
40
source/libs/string/char_traits/to_int_type.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
.. _sprout-string-char_traits-to_int_type:
|
||||
###############################################################################
|
||||
to_int_type
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
static SPROUT_CONSTEXPR int_type to_int_type(char_type c) SPROUT_NOEXCEPT;
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Equivalent to ``std::char_traits<Char>::to_int_type(c)``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR int x = 'H';
|
||||
SPROUT_STATIC_CONSTEXPR auto y = char_traits<char>::to_char_type(x);
|
||||
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::to_int_type(y);
|
||||
static_assert(char_traits<char>::eq_int_type(result, x), "a value that converted from x to char type and re-converted to int type is equal to the original x.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| constant.
|
||||
| Recursive function invocations in *O(1)* (constant) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/char_traits.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue