Spec-Zone.ru › C++

std::meta::access_context::unchecked

static consteval std::meta::access_context unchecked() noexcept;

Returns a new access_context with no associated scope, and whose designating class is the null reflection.

When the result is passed to a standard reflection function such as std::meta::is_accessible, no access check is performed. All members are considered accessible.

Return value

An access_context with no associated scope.

Notes

If an unchecked access_context has a designating class, the class is still checked when determining if a member is accessible.

constexpr auto ctx = std::meta::access_context::unchecked();

struct A {};
struct B { int x; };

// Cannot use A to name B::x
static_assert(!std::meta::is_accessible(^^B::x, ctx.via(^^A)));

Example

See also

current
[static]
constructs a std::meta::access_context associated with the scope of the call site
(public static member function)
unprivileged
[static]
constructs a std::meta::access_context associated with the scope of the global namespace
(public static member function)

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

Spec-Zone.ru

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