Namespaces
Variants

std::meta::remove_extent

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

If a type T, represented by r, is an array of some type X, returns a reflection of X. Otherwise, returns r. Note that if T is a multidimensional array, only the first extent (dimension) is “removed”.

Parameters

r - a reflection value

Return value

A reflection of X, if r represents an array type. Otherwise, r.

Exceptions

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

Example

#include <meta>

static_assert
(""
    and (remove_extent(^^int) == ^^int)
    and (remove_extent(^^int[1]) == ^^int)
    and (remove_extent(^^int[1][2]) == ^^int[2])
);

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 all extents from reflected array type
(function) [edit]
removes one extent from the given array type
(class template) [edit]