userver: utils::StringLiteral Class Reference
Loading...
Searching...
No Matches
utils::StringLiteral Class Reference

#include <userver/utils/string_literal.hpp>

Detailed Description

Non-empty string view to a compile time known null terminated char array that lives for the lifetime of program, as per [lex.string]; a drop-in replacement for static const std::string kVar = "value" and constexpr std::string_view kVar = "value".

Definition at line 27 of file string_literal.hpp.

+ Inheritance diagram for utils::StringLiteral:

Public Member Functions

USERVER_IMPL_CONSTEVAL StringLiteral (const char *literal) noexcept
 
constexpr const charc_str () const noexcept
 

Static Public Member Functions

static constexpr StringLiteral UnsafeMake (const char *str, std::size_t len) noexcept
 

Constructor & Destructor Documentation

◆ StringLiteral()

USERVER_IMPL_CONSTEVAL utils::StringLiteral::StringLiteral ( const char * literal)
inlinenoexcept

Definition at line 37 of file string_literal.hpp.

Member Function Documentation

◆ c_str()

constexpr const char * utils::NullTerminatedView::c_str ( ) const
inlineconstexprnoexceptinherited

Definition at line 33 of file null_terminated_view.hpp.

◆ UnsafeMake()

static constexpr StringLiteral utils::StringLiteral::UnsafeMake ( const char * str,
std::size_t len )
inlinestaticconstexprnoexcept

Constructs a StringLiteral from a pointer and size.

Warning
str[len] should be '\0' and str should point to compile time literal.

Definition at line 44 of file string_literal.hpp.


The documentation for this class was generated from the following file: