Namespaces
Variants

std::meta::remove_all_extents

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_all_extents( std::meta::info r );
(since C++26)

If a type T, represented by r, is a multidimensional array of some type X, returns a reflection of X. Otherwise returns r.

Equivalent to return std::meta::dealias(^^std::remove_all_extents_t<T>);.

Parameters

r - a reflection value

Return value

A reflection of an underlying type, if reflected type is a multidimensional array. Otherwise, r.

Exceptions

Throws std::meta::exception if r does not represent a type or type alias.

Example

#include <meta>

struct X;

static_assert
(""
    && (remove_all_extents(^^int) == ^^int)
    && (remove_all_extents(^^int[1]) == ^^int)
    && (remove_all_extents(^^int[1][2]) == ^^int)
    && (remove_all_extents(^^float) == ^^float)
    && (remove_all_extents(^^float[1]) == ^^float)
    && (remove_all_extents(^^float[1][2]) == ^^float)
    && (remove_all_extents(^^const float[1][2]) == ^^const float)
    && (remove_all_extents(^^float*) == ^^float*)
    && (remove_all_extents(^^X) == ^^X)
    && (remove_all_extents(^^X[1][2]) == ^^X)
);

int main() {}

See also

checks if reflected type is an array type
(function) [edit]
(C++26)
obtains the number of dimensions of reflected array type
(function) [edit]
(C++26)
obtains the size of reflected array type along a specified dimension
(function) [edit]
removes one extent from reflected array type
(function) [edit]
removes all extents from the given array type
(class template) [edit]