Spec-Zone.ru › C++

std::meta::operator_of

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

#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

  • Operators
  • Alternative operator syntax
operators
(C++26)
constants that identify overloadable operators
(enum)
symbol_ofu8symbol_of
(C++26)(C++26)
converts a meta::operators enumerator to its symbolic name
(function)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/operator_of

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API