Namespaces
Variants

std::meta::remove_cvref

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Type properties
Type property queries
 
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

removes const and/or volatile qualifiers from reflected type
(function) [edit]
removes a reference from reflected type
(function) [edit]
(C++26)
applies type transformations as when passing a function argument by value
(function) [edit]
combines std::remove_cv and std::remove_reference
(class template) [edit]