rapidyaml  0.12.0
parse and emit YAML, and do it fast

to_substr() and to_csubstr() is used in generic code like format(), and allow adding construction of substrings from new types like containers. More...

Classes

struct  c4::is_string< T >
 a traits class to mark a type as a string type (meaning c4::to_csubstr() can be used directly). More...
 
struct  c4::is_writeable_string< T >
 a traits class to mark a type as a writeable string type (meaning c4::to_substr() can be used directly). More...
 
struct  c4::is_string< basic_substring< C > >
 
struct  c4::is_writeable_string< basic_substring< char > >
 
struct  c4::is_writeable_string< basic_substring< const char > >
 
struct  c4::is_string< const char * >
 
struct  c4::is_writeable_string< const char * >
 
struct  c4::is_string< char * >
 
struct  c4::is_writeable_string< char * >
 
struct  c4::is_string< const char[N]>
 
struct  c4::is_writeable_string< const char[N]>
 
struct  c4::is_string< char[N]>
 
struct  c4::is_writeable_string< char[N]>
 
struct  c4::is_string< const char(&)[N]>
 
struct  c4::is_writeable_string< const char(&)[N]>
 
struct  c4::is_string< char(&)[N]>
 
struct  c4::is_writeable_string< char(&)[N]>
 
struct  c4::is_string< const char(&&)[N]>
 
struct  c4::is_writeable_string< const char(&&)[N]>
 
struct  c4::is_string< char(&&)[N]>
 
struct  c4::is_writeable_string< char(&&)[N]>
 

Functions

substr c4::to_substr (substr s) noexcept
 neutral version for use in generic code More...
 
csubstr c4::to_csubstr (substr s) noexcept
 neutral version for use in generic code More...
 
csubstr c4::to_csubstr (csubstr s) noexcept
 neutral version for use in generic code More...
 
template<size_t N>
substr c4::to_substr (char(&s)[N]) noexcept
 
template<size_t N>
csubstr c4::to_csubstr (const char(&s)[N]) noexcept
 
template<class U >
auto c4::to_substr (U s) noexcept -> typename std::enable_if< std::is_same< U, char * >::value, substr >::type
 
template<class U >
auto c4::to_csubstr (U s) noexcept -> typename std::enable_if< std::is_same< U, const char * >::value||std::is_same< U, char * >::value, csubstr >::type
 

Detailed Description

to_substr() and to_csubstr() is used in generic code like format(), and allow adding construction of substrings from new types like containers.

Function Documentation

◆ to_substr() [1/3]

substr c4::to_substr ( substr  s)
inlinenoexcept

neutral version for use in generic code

Definition at line 2208 of file substr.hpp.

2208 { return s; }

◆ to_csubstr() [1/4]

csubstr c4::to_csubstr ( substr  s)
inlinenoexcept

neutral version for use in generic code

Definition at line 2210 of file substr.hpp.

2210 { return csubstr{s.str, s.len}; }

◆ to_csubstr() [2/4]

csubstr c4::to_csubstr ( csubstr  s)
inlinenoexcept

neutral version for use in generic code

Definition at line 2212 of file substr.hpp.

2212 { return s; }

◆ to_substr() [2/3]

template<size_t N>
substr c4::to_substr ( char(&)  s[N])
inlinenoexcept

Definition at line 2215 of file substr.hpp.

2216 {
2217  return substr(s, N-1);
2218 }

◆ to_csubstr() [3/4]

template<size_t N>
csubstr c4::to_csubstr ( const char(&)  s[N])
inlinenoexcept

Definition at line 2219 of file substr.hpp.

2220 {
2221  return csubstr(s, N-1);
2222 }

◆ to_substr() [3/3]

template<class U >
auto c4::to_substr ( s) -> typename std::enable_if<std::is_same<U, char*>::value, substr>::type
inlinenoexcept
Note
this overload uses SFINAE to prevent it from overriding the array overload
See also
For a more detailed explanation on why the plain overloads cannot coexist, see http://cplusplus.bordoon.com/specializeForCharacterArrays.html

Definition at line 2228 of file substr.hpp.

2230 {
2231  return substr(s);
2232 }

◆ to_csubstr() [4/4]

template<class U >
auto c4::to_csubstr ( s) -> typename std::enable_if<std::is_same<U, const char*>::value || std::is_same<U, char*>::value, csubstr>::type
inlinenoexcept
Note
this overload uses SFINAE to prevent it from overriding the array overload
See also
For a more detailed explanation on why the plain overloads cannot coexist, see http://cplusplus.bordoon.com/specializeForCharacterArrays.html

Definition at line 2236 of file substr.hpp.

2238 {
2239  return csubstr(s);
2240 }