std::meta::access_context::scope, std::meta::access_context::designating_class
From cppreference.com
consteval std::meta::info scope() const;
|
(1) | |
consteval std::meta::info designating_class() const;
|
(2) | |
1) Returns a reflection of the namespace, class, or function whose scope is associated with
*this.2) Returns a reflection of the designating class of
*this.Return value
The associated scope and designating class, respectively.
Example
Run this code
#include <meta>
int main()
{
constexpr auto ctx1 = std::meta::access_context::current();
constexpr auto ctx2 = std::meta::access_context::unprivileged();
constexpr auto ctx3 = std::meta::access_context::unchecked();
static_assert(std::meta::is_function(ctx1.scope()));
static_assert(ctx2.scope() == ^^::);
static_assert(ctx3.scope() == std::meta::info{});
static_assert(ctx1.designating_class() == std::meta::info{});
struct X {};
static_assert(ctx1.via(^^X).designating_class() == ^^X);
}
See also
constructs a std::meta::access_context with a designating class (public member function) |