Represents a compile-time string. More...
#include <refl.hpp>
Public Member Functions | |
constexpr | const_string () noexcept |
Creates an empty const_string. More... | |
constexpr | const_string (const const_string< N > &other) noexcept |
Creates a copy of a const_string. More... | |
constexpr | const_string (const char(&data)[N+1]) noexcept |
Creates a const_string by copying the contents of data. More... | |
constexpr | operator const char * () const noexcept |
Explicitly converts to const char*. More... | |
operator std::string () const noexcept | |
Explicitly converts to std::string. More... | |
constexpr const char * | c_str () const noexcept |
Returns a pointer to the contained zero-terminated string. More... | |
std::string | str () const noexcept |
Returns the contained string as an std::string. More... | |
template<size_t Pos, size_t Count = npos> | |
constexpr auto | substr () const noexcept |
A constexpr version of std::string::substr. More... | |
constexpr auto | find (char ch, size_t pos=0) const noexcept |
Searches the string for the first occurrence of the character and returns its position. More... | |
constexpr auto | rfind (char ch, size_t pos=npos) const noexcept |
Searches the string for the last occurrence of the character and returns its position. More... | |
Public Attributes | |
char | data [N+1] |
The statically-sized character buffer used for storing the string. More... | |
Static Public Attributes | |
static constexpr size_t | npos = static_cast<size_t>(-1) |
The largest positive value size_t can hold. More... | |
static constexpr size_t | size = N |
The length of the string excluding the terminating '\0' character. More... | |
Represents a compile-time string.
Used in refl-cpp for representing names of reflected types and members. Supports constexpr concatenation and substring, and is explicitly-convertible to const char* and std::string. REFL_MAKE_CONST_STRING can be used to create an instance from a literal string.
@typeparam <N> The length of the string excluding the terminating '\0' character.
|
inlineconstexprnoexcept |
Creates an empty const_string.
|
inlineconstexprnoexcept |
Creates a copy of a const_string.
|
inlineconstexprnoexcept |
Creates a const_string by copying the contents of data.
|
inlineconstexprnoexcept |
Returns a pointer to the contained zero-terminated string.
|
inlineconstexprnoexcept |
Searches the string for the first occurrence of the character and returns its position.
|
inlineexplicitconstexprnoexcept |
Explicitly converts to const char*.
|
inlineexplicitnoexcept |
Explicitly converts to std::string.
|
inlineconstexprnoexcept |
Searches the string for the last occurrence of the character and returns its position.
|
inlinenoexcept |
Returns the contained string as an std::string.
|
inlineconstexprnoexcept |
A constexpr version of std::string::substr.
char refl::util::const_string< N >::data[N+1] |
The statically-sized character buffer used for storing the string.
|
staticconstexpr |
The largest positive value size_t can hold.
|
staticconstexpr |
The length of the string excluding the terminating '\0' character.