GMP 0.3.0
Generative Metaprogramming library for C++
Loading...
Searching...
No Matches
Compile-Time String Utilities

Fixed-string and string-oriented helpers for compile-time programming. More...

Classes

struct  gmp::fixed_string< N >
 A compile-time string type with fixed length and constexpr operations. More...
 

Functions

template<std::size_t N>
 gmp::fixed_string (char const(&)[N]) -> fixed_string< N - 1 >
 Deduce fixed_string length from a string literal.
 
template<std::size_t N1, std::size_t N2>
consteval fixed_string< N1+N2gmp::operator+ (fixed_string< N1 > const &s1, fixed_string< N2 > const &s2)
 Concatenate two fixed strings at compile time.
 
template<fixed_string FirstValue, fixed_string... RestValues, auto String>
consteval auto gmp::remove_all (constant_arg_t< String >)
 Remove all occurrences of one or more compile-time substrings.
 
constexpr bool gmp::is_equal (const char *lhs, const char *rhs) noexcept
 

Variables

template<std::intmax_t N>
static constexpr auto gmp::to_fixed_string_v
 

Detailed Description

Function Documentation

◆ fixed_string()

template<std::size_t N>
gmp::fixed_string ( char const   (&)[N]) -> fixed_string< N - 1 >
Template Parameters
NThe size of the source character array including the null terminator.

◆ is_equal()

constexpr bool gmp::is_equal ( const char lhs,
const char rhs 
)
constexprnoexcept

Definition at line 21 of file string.hpp.

References gmp::enum_values(), and gmp::is_equal().

Referenced by gmp::is_equal().

◆ operator+()

template<std::size_t N1, std::size_t N2>
consteval fixed_string< N1+N2 > gmp::operator+ ( fixed_string< N1 > const s1,
fixed_string< N2 > const s2 
)
Template Parameters
N1The length of the left-hand string.
N2The length of the right-hand string.
Parameters
s1The left-hand operand.
s2The right-hand operand.
Returns
A new fixed_string containing the concatenated result.

Definition at line 175 of file fixed_string.hpp.

References gmp::enum_values().

◆ remove_all()

template<fixed_string FirstValue, fixed_string... RestValues, auto String>
consteval auto gmp::remove_all ( constant_arg_t< String )
Template Parameters
FirstValueThe first substring to remove.
RestValuesAdditional substrings to remove after FirstValue.
StringThe input compile-time string.
Parameters
Thecompile-time input string wrapper.
Returns
A new fixed_string with all requested substrings removed.

Definition at line 229 of file fixed_string.hpp.

References gmp::enum_values(), and gmp::remove_all().

Referenced by gmp::remove_all(), and gmp::type_name().

Variable Documentation

◆ to_fixed_string_v

template<std::intmax_t N>
constexpr auto gmp::to_fixed_string_v
staticconstexpr

Definition at line 56 of file to_fixed_string.hpp.