rapidyaml  0.10.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...

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 >
std::enable_if< std::is_same< U, char * >::value, substr >::type c4::to_substr (U s) noexcept
 
template<class U >
std::enable_if< std::is_same< U, const char * >::value||std::is_same< U, char * >::value, csubstr >::type c4::to_csubstr (U s) noexcept
 

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]

◆ to_csubstr() [1/4]

◆ to_csubstr() [2/4]

csubstr c4::to_csubstr ( csubstr  s)
inlinenoexcept

neutral version for use in generic code

Definition at line 2188 of file substr.hpp.

2188 { return s; }

◆ to_substr() [2/3]

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

Definition at line 2193 of file substr.hpp.

2193 { substr ss(s, N-1); return ss; }

◆ to_csubstr() [3/4]

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

Definition at line 2196 of file substr.hpp.

2196 { csubstr ss(s, N-1); return ss; }

◆ to_substr() [3/3]

template<class U >
std::enable_if<std::is_same<U, char*>::value, substr>::type c4::to_substr ( s)
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 2204 of file substr.hpp.

2204 { substr ss(s); return ss; }

◆ to_csubstr() [4/4]

template<class U >
std::enable_if<std::is_same<U, const char*>::value || std::is_same<U, char*>::value, csubstr>::type c4::to_csubstr ( s)
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 2210 of file substr.hpp.

2210 { csubstr ss(s); return ss; }