std::meta::operator_of
From cppreference.com
| Defined in header <meta>
|
||
consteval std::meta::operators operator_of( std::meta::info r );
|
(since C++26) | |
Returns the value of the enumerator from std::meta::operators whose corresponding operator-function-id is the unqualified name of the entity represented by r.
Parameters
| r | - | a reflection value |
Return value
The value of the enumerator.
Exceptions
std::meta::exception if r does not represent an operator function or operator function template.
Example
Run this code
#include <meta>
struct S
{
S& operator+=(int);
};
static_assert(operator_of(^^S::operator+=) == std::meta::op_plus_equals);
// constexpr auto x_x = operator_of(^^S); // throws at compile-time:
// reflection does not represent
// operator function (template)
int main() {}
See also
(C++26) |
constants that identify overloadable operators (enum) |
(C++26)(C++26) |
converts a meta::operators enumerator to its symbolic name (function) |