tinympl  0.2
mini MPL library for C++11
tinympl::basic_string< T, chars > Class Template Reference

A vector of values of type T. More...

#include <tinympl/string.hpp>

Classes

class  replace
 Return a new string constructed by replacing count characters starting at pos with the string Str. More...
 
class  substr
 Return a substring long count starting at position pos. More...
 

Public Types

enum  { size = sizeof ... (chars) }
 
enum  { empty = (size == 0) }
 
typedef basic_string< T, chars...> type
 This type.
 
typedef T value_type
 The type of the string characters.
 
template<std::size_t pos, class Str >
using insert = tinympl::insert< pos, Str, basic_string< T, chars...> >
 Return a new string constructed by inserting the string Str at the position pos. More...
 
template<std::size_t pos, T... NewChars>
using insert_c = insert< pos, basic_string< T, NewChars...> >
 Return a new string constructed by inserting the characters NewChars... at the position pos More...
 
template<std::size_t pos, std::size_t count>
using erase = tinympl::erase< pos, pos+count, basic_string< T, chars...> >
 Return a new string constructed by removing count characters starting at position pos. More...
 
template<class Str >
using append = insert< size, Str >
 Return a new string constructed by appending the string Str at the end of this string. More...
 
template<T... NewChars>
using append_c = insert_c< size, NewChars...>
 Return a new string constructed by appending the characters NewChars... at the end of this string. More...
 
template<std::size_t pos, std::size_t count, T... ts>
using replace_c = replace< pos, count, basic_string< T, ts...> >
 Return a new string constructed by replacing count characters starting at pos with the characters ts... More...
 
template<class OtherStr >
using compare = lexicographical_compare< basic_string< T, chars...>, OtherStr >
 Alias for lexicographical_compare, mimic std::string::compare. More...
 
template<class Str >
using find = find_impl< Str, 0, size >
 Return the index of the first character of the first occurrence of the substring Str, or size if Str is not a substring of this string. More...
 
template<class Str >
using rfind = rfind_impl< Str, size >
 Return the index of the first character of the last occurrence of the substring Str, or size if Str is not a substring of this string.
 
template<T... ts>
using find_c = find< basic_string< T, ts...> >
 Return the index of the first character of the first occurrence of the substring ts..., or size if ts... is not a substring of this string.
 
template<T... ts>
using rfind_c = rfind< basic_string< T, ts...> >
 Return the index of the first character of the last occurrence of the substring ts..., or size if ts... is not a substring of this string.
 

Static Public Member Functions

static constexpr value_type at (std::size_t i)
 Get the i-th character. More...
 
static constexpr const_pointer c_str ()
 Return a pointer to a null-terminated C-style string.
 
static constexpr value_type front ()
 Return a copy of the first character.
 
static constexpr value_type back ()
 Return a copy of the last character.
 

Detailed Description

template<class T, T... chars>
class tinympl::basic_string< T, chars >

A vector of values of type T.

Parameters
TThe type of the characters
chars...The characters which compose the string

Member Typedef Documentation

template<class T , T... chars>
template<class Str >
using tinympl::basic_string< T, chars >::append = insert<size,Str>

Return a new string constructed by appending the string Str at the end of this string.

See also
append_c
template<class T , T... chars>
template<T... NewChars>
using tinympl::basic_string< T, chars >::append_c = insert_c<size,NewChars...>

Return a new string constructed by appending the characters NewChars... at the end of this string.

See also
append
template<class T , T... chars>
template<class OtherStr >
using tinympl::basic_string< T, chars >::compare = lexicographical_compare< basic_string<T,chars...>, OtherStr>

Alias for lexicographical_compare, mimic std::string::compare.

See also
lexicographical_compare
template<class T , T... chars>
template<std::size_t pos, std::size_t count>
using tinympl::basic_string< T, chars >::erase = tinympl::erase<pos,pos + count, basic_string<T,chars...> >

Return a new string constructed by removing count characters starting at position pos.

Warning
In order to mimic the behavior of std::string, this function takes an index and a size of the range, not a [first,last) range.
template<class T , T... chars>
template<class Str >
using tinympl::basic_string< T, chars >::find = find_impl<Str,0,size>

Return the index of the first character of the first occurrence of the substring Str, or size if Str is not a substring of this string.

See also
rfind
find_c
template<class T , T... chars>
template<std::size_t pos, class Str >
using tinympl::basic_string< T, chars >::insert = tinympl::insert<pos, Str, basic_string<T,chars...> >

Return a new string constructed by inserting the string Str at the position pos.

See also
insert_c
template<class T , T... chars>
template<std::size_t pos, T... NewChars>
using tinympl::basic_string< T, chars >::insert_c = insert<pos, basic_string<T,NewChars...> >

Return a new string constructed by inserting the characters NewChars... at the position pos

See also
insert
template<class T , T... chars>
template<std::size_t pos, std::size_t count, T... ts>
using tinympl::basic_string< T, chars >::replace_c = replace<pos,count, basic_string<T,ts...> >

Return a new string constructed by replacing count characters starting at pos with the characters ts...

See also
replace

Member Enumeration Documentation

template<class T , T... chars>
anonymous enum
Enumerator
size 

The size of the vector.

template<class T , T... chars>
anonymous enum
Enumerator
empty 

Determine whether the vector is empty.

Member Function Documentation

template<class T , T... chars>
static constexpr value_type tinympl::basic_string< T, chars >::at ( std::size_t  i)
inlinestatic

Get the i-th character.

Warning
If this function is called in a non-constexpr context, no out of range protection is provided

The documentation for this class was generated from the following file: