std::meta::symbol_of, std::meta::u8symbol_of
Defined in header <meta> | ||
|---|---|---|
consteval std::string_view symbol_of( std::meta::operators op ); | (1) | (since C++26) |
consteval std::u8string_view u8symbol_of( std::meta::operators op ); | (2) | (since C++26) |
1) Returns a
std::string_view containing the characters of the operator symbol name corresponding to op, encoded with the ordinary literal encoding.
2) Returns a
std::u8string_view containing the characters of the operator symbol name corresponding to op, encoded with the with UTF-8.Parameters
| op | - | an enumerator in std::meta::operators whose character representation to return |
Return value
The characters of the operator symbol name.
Exceptions
std::meta::exception if op does not corresponds to one of the enumerators in std::meta::operators.
Example
#include <meta>
#include <print>
int main()
{
template for (constexpr auto op :
{
std::meta::operators::op_array_new,
std::meta::operators::op_co_await,
std::meta::operators::op_square_brackets
})
std::println("{}", std::meta::symbol_of(op));
}
Output:
new[] co_await []
See also
|
(C++26) | constants that identify overloadable operators (enum) |
|
(C++26) | identifies the operator represented by the reflection (function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/symbol_of