std::meta::remove_extent
From cppreference.com
| 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
Run this code
#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
(C++26) |
checks if reflected type is an array type (function) |
(C++26) |
obtains the number of dimensions of reflected array type (function) |
(C++26) |
obtains the size of reflected array type along a specified dimension (function) |
(C++26) |
removes all extents from reflected array type (function) |
(C++11) |
removes one extent from the given array type (class template) |