std::define_static_string - cppreference.com
From cppreference.com
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
Return value
A pointer to the first element of a character array object which is the template parameter object with the contents of r.
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.
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_define_static |
202506L |
(C++26) | std::define_static_string
|
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] |