Boost C++ Libraries

PrevUpHomeNext

Struct template constexpr_string

boost::taar::constexpr_string — A fixed-length string usable as a non-type template parameter.

Synopsis

// In header: <boost/taar/core/constexpr_string.hpp>

template<std::size_t N> 
struct constexpr_string {

  // public member functions
  constexpr_string(char const (&));
  constexpr char const * c_str() const;
  constexpr std::size_t size() const;
  constexpr std::string string() const;
  constexpr operator std::string() const;

  // public data members
  std::array< char, N > data;
};

Description

constexpr_string is a literal type that can be passed as an NTTP, making it possible to tag types with string identifiers at compile time. Construct it from a string literal:

using boost::taar::literals;
constexpr auto kind = "users"_cs;

Template Parameters

  1. std::size_t N

    The length of the underlying character array, including the terminating null.

constexpr_string public member functions

  1. constexpr_string(char const (&) str);
  2. constexpr char const * c_str() const;
  3. constexpr std::size_t size() const;
  4. constexpr std::string string() const;
  5. constexpr operator std::string() const;

PrevUpHomeNext