std::meta::remove_cvref
Defined in header <meta> | ||
|---|---|---|
consteval std::meta::info remove_cvref( std::meta::info r ); | (since C++26) |
If r represents a reference type T, returns a reflection that represents the type referred to by T with its topmost cv-qualifiers removed. Otherwise, returns r with its topmost cv-qualifiers removed.
Parameters
| r | - | a reflection value |
Return value
A reflection of the underlying type T, with reference (if present) and topmost cv-qualifiers removed.
Exceptions
Throws std::meta::exception if r does not represent a type or type alias.
Example
#include <meta>
static_assert
(
(remove_cvref(^^int) == ^^int) &&
(remove_cvref(^^const int&) == ^^int) &&
(remove_cvref(^^volatile int&&) == ^^int) &&
(remove_cvref(^^const int&) == ^^int) &&
(remove_cvref(^^const int[2]) == ^^int[2]) &&
(remove_cvref(^^const int(&)[2]) == ^^int[2]) &&
(remove_cvref(^^int(int)) == ^^int(int))
);
int main() {}
See also
|
(C++26)(C++26)(C++26) | removes const and/or volatile qualifiers from reflected type (function) |
|
(C++26) | removes a reference from reflected type (function) |
|
(C++26) | applies type transformations as when passing a function argument by value (function) |
|
(C++20) | combines std::remove_cv and std::remove_reference (class template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/remove_cvref