Namespaces
Variants

std::define_static_string

From cppreference.com
< cpp | meta
Defined in header <meta>
template< ranges::input_range R >
consteval const ranges::range_value_t<R>* define_static_string( R&& r );
(since C++26)

Promotes character array to static storage. A null character is appended if r is not a string literal object.

Equivalent to:

return std::meta::extract<const ranges::range_value_t<R>*>(std::meta::reflect_constant_string(r));

Parameters

r - a input_range of characters

Return value

A pointer to the first element of a character array object which is a template parameter object.

Notes

As a template parameter object, the resulting string object has static storage duration. Strings with the same contents correspond to the same object.

The resulting template parameter object is a potentially non-unique object.

Example

See also

promotes compile-time array into static storage, returning a span of the static array
(function template) [edit]
promotes compile-time value into static storage, returning a pointer to the static object
(function template) [edit]
promotes a compile-time string to static storage, returning a reflection representing the static string
(function template) [edit]