1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-07-02 14:04:09 +00:00

add doc: basic_string index

This commit is contained in:
Bolero-MURAKAMI 2013-09-06 14:27:44 +09:00
parent dd0c5f4dbb
commit 260291ea69
19 changed files with 2073 additions and 405 deletions

View file

@ -22,8 +22,8 @@ array
size
max_size
empty
at
operator-subscript
at
front
back
data
@ -34,71 +34,7 @@ Interface
.. sourcecode:: c++
template <typename T, std::size_t N>
class array {
// types:
typedef T& reference;
typedef T const& const_reference;
typedef /*implementation-defined*/ iterator;
typedef /*implementation-defined*/ const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T const* const_pointer;
typedef sprout::reverse_iterator<iterator> reverse_iterator;
typedef sprout::reverse_iterator<const_iterator> const_reverse_iterator;
// constants:
SPROUT_STATIC_CONSTEXPR size_type static_size = N;
T elems[N ? N : 1]; // exposition only
// construct/copy/destroy:
template<typename T2>
array& operator=(array<T2, N> const& rhs);
template<typename T2>
array& operator=(array<T2, N>&& rhs);
// modifiers:
void fill(const_reference value);
SPROUT_CONSTEXPR array fill(const_reference value) const;
void assign(const_reference value);
SPROUT_CONSTEXPR array assign(const_reference value) const;
void swap(array&) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::swap(std::declval<T&>(), std::declval<T&>())));
// iterators:
iterator begin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator begin() const SPROUT_NOEXCEPT;
iterator end() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT;
reverse_iterator rbegin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT;
reverse_iterator rend() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT;
// capacity:
SPROUT_CONSTEXPR size_type size() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT;
// element access:
reference operator[](size_type n);
SPROUT_CONSTEXPR const_reference operator[](size_type n) const;
reference at(size_type n);
SPROUT_CONSTEXPR const_reference at(size_type n) const;
reference front();
SPROUT_CONSTEXPR const_reference front() const;
reference back();
SPROUT_CONSTEXPR const_reference back() const;
pointer data() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer data() const SPROUT_NOEXCEPT;
pointer c_array() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer c_array() const SPROUT_NOEXCEPT;
};
class array;
Description
========================================
@ -205,3 +141,73 @@ Header
Convenience header: ``sprout/array.hpp``
Interface of all
========================================
.. sourcecode:: c++
template <typename T, std::size_t N>
class array {
// types:
typedef T& reference;
typedef T const& const_reference;
typedef /*implementation-defined*/ iterator;
typedef /*implementation-defined*/ const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T const* const_pointer;
typedef sprout::reverse_iterator<iterator> reverse_iterator;
typedef sprout::reverse_iterator<const_iterator> const_reverse_iterator;
// constants:
SPROUT_STATIC_CONSTEXPR size_type static_size = N;
T elems[N ? N : 1]; // exposition only
// construct/copy/destroy:
template<typename T2>
array& operator=(array<T2, N> const& rhs);
template<typename T2>
array& operator=(array<T2, N>&& rhs);
// modifiers:
void fill(const_reference value);
SPROUT_CONSTEXPR array fill(const_reference value) const;
void assign(const_reference value);
SPROUT_CONSTEXPR array assign(const_reference value) const;
void swap(array&) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::swap(std::declval<T&>(), std::declval<T&>())));
// iterators:
iterator begin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator begin() const SPROUT_NOEXCEPT;
iterator end() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT;
reverse_iterator rbegin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT;
reverse_iterator rend() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT;
// capacity:
SPROUT_CONSTEXPR size_type size() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT;
// element access:
reference operator[](size_type n);
SPROUT_CONSTEXPR const_reference operator[](size_type n) const;
reference at(size_type n);
SPROUT_CONSTEXPR const_reference at(size_type n) const;
reference front();
SPROUT_CONSTEXPR const_reference front() const;
reference back();
SPROUT_CONSTEXPR const_reference back() const;
pointer data() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer data() const SPROUT_NOEXCEPT;
pointer c_array() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer c_array() const SPROUT_NOEXCEPT;
};

View file

@ -0,0 +1,402 @@
.. _sprout-string-basic_string:
###############################################################################
basic_string
###############################################################################
.. toctree::
:hidden:
constructor-
operator-assign
begin
end
rbegin
rend
cbegin
cend
crbegin
crend
size
length
max_size
resize
clear
empty
operator-subscript
at
front
back
assign
swap
data
c_array
data
find
rfind
find_first_of
find_last_of
find_first_not_of
find_last_not_of
substr
compare
operator-std-basic_string
operator-assign-iterator
assign-iterator
find-iterator
rfind-iterator
find_first_of-iterator
find_last_of-iterator
find_first_not_of-iterator
find_last_not_of-iterator
compare-iterator
Interface
========================================
.. sourcecode:: c++
template <typename T, std::size_t N, typename Traits = sprout::char_traits<T> >
class basic_string;
Description
========================================
Member types
----------------------------------------
======================================== =============================================================================== =======================================
type definition note
======================================== =============================================================================== =======================================
traits_type Traits
value_type Traits::char_type
size_type std::size_t
difference_type std::ptrdiff_t
reference value_type&
const_reference value_type const&
pointer value_type*
const_pointer value_type const*
iterator **ConstexprRandomAccessIterator** convertible to const_iterator,
convertible to pointer
const_iterator **ConstexprRandomAccessIterator** convertible to const_pointer
reverse_iterator sprout::reverse_iterator<iterator>,
**ConstexprRandomAccessIterator**
const_reverse_iterator sprout::reverse_iterator<const_iterator>,
**ConstexprRandomAccessIterator**
======================================== =============================================================================== =======================================
Member functions
----------------------------------------
construct/copy/destroy
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`(constructor) <./constructor->`
:doc:`operator= <./operator-assign>`
======================================== ===============================================================================
iterators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`begin <./begin>`
:doc:`end <./end>`
:doc:`rbegin <./rbegin>`
:doc:`rend <./rend>`
:doc:`cbegin <./cbegin>`
:doc:`cend <./cend>`
:doc:`crbegin <./crbegin>`
:doc:`crend <./crend>`
======================================== ===============================================================================
capacity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`size <./size>`
:doc:`length <./length>`
:doc:`max_size <./max_size>`
:doc:`resize <./resize>`
:doc:`clear <./clear>`
:doc:`empty <./empty>`
======================================== ===============================================================================
element access
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`operator[] <./operator-subscript>`
:doc:`at <./at>`
:doc:`front <./front>`
:doc:`back <./back>`
======================================== ===============================================================================
modifiers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`assign <./assign>`
:doc:`swap <./swap>`
======================================== ===============================================================================
string operations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
============================================================ ===============================================================================
function
============================================================ ===============================================================================
:doc:`data <./data>`
:doc:`c_array <./c_array>`
:doc:`find <./find>`
:doc:`rfind <./rfind>`
:doc:`find_first_of <./find_first_of>`
:doc:`find_last_of <./find_last_of>`
:doc:`find_first_not_of <./find_first_not_of>`
:doc:`find_last_not_of <./find_last_not_of>`
:doc:`substr <./substr>`
:doc:`compare <./compare>`
============================================================ ===============================================================================
conversions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
================================================================================ ===============================================================================
function
================================================================================ ===============================================================================
:doc:`operator std::basic_string <./operator-std-basic_string>`
================================================================================ ===============================================================================
construct/copy/destroy (for string iterator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
============================================================ ===============================================================================
function
============================================================ ===============================================================================
:doc:`operator= <./operator-assign-iterator>`
============================================================ ===============================================================================
modifiers (for string iterator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`assign <./assign-iterator>`
======================================== ===============================================================================
string operations (for string iterator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
============================================================ ===============================================================================
function
============================================================ ===============================================================================
:doc:`find <./find-iterator>`
:doc:`rfind <./rfind-iterator>`
:doc:`find_first_of <./find_first_of-iterator>`
:doc:`find_last_of <./find_last_of-iterator>`
:doc:`find_first_not_of <./find_first_not_of-iterator>`
:doc:`find_last_not_of <./find_last_not_of-iterator>`
:doc:`compare <./compare-iterator>`
============================================================ ===============================================================================
Header
========================================
``sprout/string/string.hpp``
Convenience header: ``sprout/string.hpp``
Interface of all
========================================
.. sourcecode:: c++
template <typename T, std::size_t N, typename Traits = sprout::char_traits<T> >
class basic_string {
// types:
typedef Traits traits_type;
typedef typename Traits::char_type value_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef value_type& reference;
typedef value_type const& const_reference;
typedef value_type* pointer;
typedef value_type const* const_pointer;
typedef /*implementation-defined*/ iterator;
typedef /*implementation-defined*/ const_iterator;
typedef sprout::reverse_iterator<iterator> reverse_iterator;
typedef sprout::reverse_iterator<const_iterator> const_reverse_iterator;
// constants:
SPROUT_STATIC_CONSTEXPR size_type npos = -1;
SPROUT_STATIC_CONSTEXPR size_type static_size = N;
// construct/copy/destroy:
SPROUT_CONSTEXPR basic_string() = default;
SPROUT_CONSTEXPR basic_string(basic_string const&) = default;
template<std::size_t N2, typename Enable = typename std::enable_if<(N2 < N)>::type>
SPROUT_CONSTEXPR basic_string(basic_string<T, N2, Traits> const& str);
SPROUT_CONSTEXPR basic_string(basic_string const& str, size_type pos, size_type n = npos);
template<std::size_t N2, typename Enable = typename std::enable_if<(N2 < N)>::type>
SPROUT_CONSTEXPR basic_string(basic_string<T, N2, Traits> const& str, size_type pos, size_type n = npos);
template<std::size_t N2, typename Enable = typename std::enable_if<(N2 - 1 <= N)>::type>
SPROUT_CONSTEXPR basic_string(T const(& arr)[N2]);
template<std::size_t N2, typename Enable = typename std::enable_if<(N2 - 1 <= N)>::type>
SPROUT_CONSTEXPR basic_string(T const(& arr)[N2], size_type n);
explicit SPROUT_CONSTEXPR basic_string(value_type const* s);
SPROUT_CONSTEXPR basic_string(value_type const* s, size_type n);
template<typename InputIterator>
SPROUT_CONSTEXPR basic_string(InputIterator first, InputIterator last);
basic_string(std::initializer_list<value_type> il);
basic_string& operator=(basic_string const& rhs);
template<std::size_t N2, typename Enable = typename std::enable_if<(N2 != N)>::type>
basic_string& operator=(basic_string<T, N2, Traits> const& rhs);
basic_string& operator=(value_type const* rhs);
basic_string& operator=(value_type rhs);
// iterators:
iterator begin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator begin() const SPROUT_NOEXCEPT;
iterator end() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT;
reverse_iterator rbegin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT;
reverse_iterator rend() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT;
// capacity:
SPROUT_CONSTEXPR size_type size() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type length() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT;
void resize(size_type n, value_type c);
void resize(size_type n);
void clear();
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT;
// element access:
reference operator[](size_type i);
SPROUT_CONSTEXPR const_reference operator[](size_type i) const;
reference at(size_type i);
SPROUT_CONSTEXPR const_reference at(size_type i) const;
reference front();
SPROUT_CONSTEXPR const_reference front() const;
reference back();
SPROUT_CONSTEXPR const_reference back() const;
// modifiers:
template<std::size_t N2>
basic_string& assign(basic_string<T, N2, Traits> const& str);
template<std::size_t N2>
basic_string& assign(basic_string<T, N2, Traits> const& str, size_type pos, size_type n);
basic_string& assign(value_type const* s, size_type n);
basic_string& assign(value_type const* s);
basic_string& assign(size_type n, value_type c);
template<typename Iterator>
basic_string& assign(Iterator first, Iterator last);
void swap(basic_string& other) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::swap(std::declval<T&>(), std::declval<T&>())));
// string operations:
SPROUT_CONSTEXPR const_pointer c_str() const SPROUT_NOEXCEPT;
pointer data() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer data() const SPROUT_NOEXCEPT;
pointer c_array() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer c_array() const SPROUT_NOEXCEPT;
template<std::size_t N2>
SPROUT_CONSTEXPR size_type find(basic_string<T, N2, Traits> const& str, size_type pos = 0) const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type find(value_type const* s, size_type pos, size_type n) const;
SPROUT_CONSTEXPR size_type find(value_type const* s, size_type pos = 0) const;
SPROUT_CONSTEXPR size_type find(value_type c, size_type pos = 0) const;
template<std::size_t N2>
SPROUT_CONSTEXPR size_type rfind(basic_string<T, N2, Traits> const& str, size_type pos = npos) const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type rfind(value_type const* s, size_type pos, size_type n) const;
SPROUT_CONSTEXPR size_type rfind(value_type const* s, size_type pos = npos) const;
SPROUT_CONSTEXPR size_type rfind(value_type c, size_type pos = npos) const;
template<std::size_t N2>
SPROUT_CONSTEXPR size_type find_first_of(basic_string<T, N2, Traits> const& str, size_type pos = 0) const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type find_first_of(value_type const* s, size_type pos, size_type n) const;
SPROUT_CONSTEXPR size_type find_first_of(value_type const* s, size_type pos = 0) const;
SPROUT_CONSTEXPR size_type find_first_of(value_type c, size_type pos = 0) const;
template<std::size_t N2>
SPROUT_CONSTEXPR size_type find_last_of(basic_string<T, N2, Traits> const& str, size_type pos = npos) const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type find_last_of(value_type const* s, size_type pos, size_type n) const;
SPROUT_CONSTEXPR size_type find_last_of(value_type const* s, size_type pos = npos) const;
SPROUT_CONSTEXPR size_type find_last_of(value_type c, size_type pos = npos) const;
template<std::size_t N2>
SPROUT_CONSTEXPR size_type find_first_not_of(basic_string<T, N2, Traits> const& str, size_type pos = 0) const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type find_first_not_of(value_type const* s, size_type pos, size_type n) const;
SPROUT_CONSTEXPR size_type find_first_not_of(value_type const* s, size_type pos = 0) const;
SPROUT_CONSTEXPR size_type find_first_not_of(value_type c, size_type pos = 0) const;
template<std::size_t N2>
SPROUT_CONSTEXPR size_type find_last_not_of(basic_string<T, N2, Traits> const& str, size_type pos = npos) const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type find_last_not_of(value_type const* s, size_type pos, size_type n) const;
SPROUT_CONSTEXPR size_type find_last_not_of(value_type const* s, size_type pos = npos) const;
SPROUT_CONSTEXPR size_type find_last_not_of(value_type c, size_type pos = npos) const;
SPROUT_CONSTEXPR basic_string substr(size_type pos = 0, size_type n = npos) const;
template<std::size_t N2>
SPROUT_CONSTEXPR int compare(basic_string<T, N2, Traits> const& str) const;
SPROUT_CONSTEXPR int compare(value_type const* s) const;
template<std::size_t N2>
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string<T, N2, Traits> const& str) const;
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, value_type const* s) const;
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;
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, value_type const* s, size_type n2) const;
// conversions:
template<typename Allocator>
SPROUT_EXPLICIT_CONVERSION operator std::basic_string<T, Traits, Allocator>() const;
// construct/copy/destroy (for string iterator):
template<typename StringConstIterator>
basic_string& operator=(StringConstIterator rhs);
// modifiers (for string iterator):
template<typename StringConstIterator>
basic_string& assign(StringConstIterator s, size_type n);
template<typename StringConstIterator>
basic_string& assign(StringConstIterator s);
// string operations (for string iterator):
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find(StringConstIterator s, size_type pos, size_type n) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find(StringConstIterator s, size_type pos = 0) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type rfind(StringConstIterator s, size_type pos, size_type n) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type rfind(StringConstIterator s, size_type pos = npos) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find_first_of(StringConstIterator s, size_type pos, size_type n) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find_first_of(StringConstIterator s, size_type pos = 0) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find_last_of(StringConstIterator s, size_type pos, size_type n) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find_last_of(StringConstIterator s, size_type pos = 0) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find_first_not_of(StringConstIterator s, size_type pos, size_type n) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find_first_not_of(StringConstIterator s, size_type pos = 0) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find_last_not_of(StringConstIterator s, size_type pos, size_type n) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR size_type find_last_not_of(StringConstIterator s, size_type pos = npos) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR int compare(StringConstIterator s) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, StringConstIterator s) const;
template<typename StringConstIterator>
SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, StringConstIterator s, size_type n2) const;
};

View file

@ -32,52 +32,7 @@ Interface
.. sourcecode:: c++
template<typename Char>
struct char_traits {
// types:
typedef typename std::char_traits<Char>::char_type char_type;
typedef typename std::char_traits<Char>::int_type int_type;
typedef typename std::char_traits<Char>::off_type off_type;
typedef typename std::char_traits<Char>::pos_type pos_type;
typedef typename std::char_traits<Char>::state_type state_type;
// character operations:
static void assign(char_type& c1, char_type const& c2) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR bool eq(char_type c1, char_type c2) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR bool lt(char_type c1, char_type c2) SPROUT_NOEXCEPT;
// string operations:
static SPROUT_CONSTEXPR int compare(char_type const* s1, char_type const* s2, std::size_t n);
static SPROUT_CONSTEXPR std::size_t length(char_type const* s);
static SPROUT_CONSTEXPR char_type const* find(char_type const* s, std::size_t n, char_type const& a);
static char_type* move(char_type* s1, char_type const* s2, std::size_t n);
static char_type* copy(char_type* s1, char_type const* s2, std::size_t n);
static char_type* assign(char_type* s, std::size_t n, char_type a);
// integer type operations:
static SPROUT_CONSTEXPR int_type not_eof(int_type c) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR char_type to_char_type(int_type c) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR int_type to_int_type(char_type c) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR bool eq_int_type(int_type c1, int_type c2) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR int_type eof() SPROUT_NOEXCEPT;
// string operations (for iterator):
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(char_type const* s1, ConstInputIterator s2, std::size_t n);
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(ConstInputIterator s1, char_type const* s2, std::size_t n);
template<typename ConstInputIterator1, typename ConstInputIterator2>
static SPROUT_CONSTEXPR int compare(ConstInputIterator1 s1, ConstInputIterator2 s2, std::size_t n);
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s);
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR ConstInputIterator find(ConstInputIterator s, std::size_t n, char_type const& a);
template<typename OutputIterator, typename ConstInputIterator>
static OutputIterator move(OutputIterator s1, ConstInputIterator s2, std::size_t n);
template<typename OutputIterator, typename ConstInputIterator>
static OutputIterator copy(OutputIterator s1, ConstInputIterator s2, std::size_t n);
template<typename OutputIterator>
static OutputIterator assign(OutputIterator s, std::size_t n, char_type a);
};
struct char_traits;
Description
========================================
@ -157,3 +112,54 @@ Header
Convenience header: ``sprout/string.hpp``
Interface of all
========================================
.. sourcecode:: c++
template<typename Char>
struct char_traits {
// types:
typedef typename std::char_traits<Char>::char_type char_type;
typedef typename std::char_traits<Char>::int_type int_type;
typedef typename std::char_traits<Char>::off_type off_type;
typedef typename std::char_traits<Char>::pos_type pos_type;
typedef typename std::char_traits<Char>::state_type state_type;
// character operations:
static void assign(char_type& c1, char_type const& c2) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR bool eq(char_type c1, char_type c2) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR bool lt(char_type c1, char_type c2) SPROUT_NOEXCEPT;
// string operations:
static SPROUT_CONSTEXPR int compare(char_type const* s1, char_type const* s2, std::size_t n);
static SPROUT_CONSTEXPR std::size_t length(char_type const* s);
static SPROUT_CONSTEXPR char_type const* find(char_type const* s, std::size_t n, char_type const& a);
static char_type* move(char_type* s1, char_type const* s2, std::size_t n);
static char_type* copy(char_type* s1, char_type const* s2, std::size_t n);
static char_type* assign(char_type* s, std::size_t n, char_type a);
// integer type operations:
static SPROUT_CONSTEXPR int_type not_eof(int_type c) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR char_type to_char_type(int_type c) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR int_type to_int_type(char_type c) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR bool eq_int_type(int_type c1, int_type c2) SPROUT_NOEXCEPT;
static SPROUT_CONSTEXPR int_type eof() SPROUT_NOEXCEPT;
// string operations (for iterator):
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(char_type const* s1, ConstInputIterator s2, std::size_t n);
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(ConstInputIterator s1, char_type const* s2, std::size_t n);
template<typename ConstInputIterator1, typename ConstInputIterator2>
static SPROUT_CONSTEXPR int compare(ConstInputIterator1 s1, ConstInputIterator2 s2, std::size_t n);
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s);
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR ConstInputIterator find(ConstInputIterator s, std::size_t n, char_type const& a);
template<typename OutputIterator, typename ConstInputIterator>
static OutputIterator move(OutputIterator s1, ConstInputIterator s2, std::size_t n);
template<typename OutputIterator, typename ConstInputIterator>
static OutputIterator copy(OutputIterator s1, ConstInputIterator s2, std::size_t n);
template<typename OutputIterator>
static OutputIterator assign(OutputIterator s, std::size_t n, char_type a);
};

View file

@ -7,6 +7,11 @@ Sprout.String
:hidden:
char_traits/index
basic_string/index
string
wstring
u16string
u32string
basic_string/swap-global
basic_string/operator-plus
basic_string/operator-equal_to
@ -15,6 +20,40 @@ Sprout.String
basic_string/operator-greater
basic_string/operator-less_equal
basic_string/operator-greater_equal
basic_string/operator-left_shift
basic_string/operator-right_shift
string_to_int
stoi
stol
stoul
stoll
stoull
stoimax
stoumax
from_string-inttype
string_to_float
stof
stod
stold
from_string-floattype
int_to_string
to_string_of-inttype
to_string-inttype
to_wstring-inttype
to_u16string-inttype
to_u32string-inttype
float_to_string
float_to_string_exp
to_string_of-floattype
to_string-floattype
to_wstring-floattype
to_u16string-floattype
to_u32string-floattype
to_string
string_from_c_str
make_string
shrink
stretch
basic_string/std-tuple_size
basic_string/std-tuple_element
basic_string/tuple_get
@ -40,11 +79,19 @@ String classes
class
============================================================ ===============================================================================
:doc:`basic_string <./basic_string/index>`
============================================================ ===============================================================================
basic_string aliases
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
======================================== ===============================================================================
aliases
======================================== ===============================================================================
:doc:`string <./string>`
:doc:`wstring <./wstring>`
:doc:`u16string <./u16string>`
:doc:`u32string <./u32string>`
============================================================ ===============================================================================
======================================== ===============================================================================
Non-member functions
----------------------------------------
@ -103,7 +150,6 @@ function
:doc:`stoul <./stoul>`
:doc:`stoll <./stoll>`
:doc:`stoull <./stoull>`
:doc:`stoull <./stoull>`
:doc:`stoimax <./stoimax>`
:doc:`stoumax <./stoumax>`
:doc:`from_string \<IntType\> <./from_string-inttype>`