std::define_static_string
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 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
|
(C++26) | promotes compile-time array into static storage, returning a span of the static array (function template) |
|
(C++26) | promotes compile-time value into static storage, returning a pointer to the static object (function template) |
|
(C++26) | promotes a compile-time string to static storage, returning a reflection representing the static string (function template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/define_static_string