class template
<type_traits>
std::remove_extenttemplate <class T> struct remove_extent;
Remove array extent
Obtains the type of the elements in T (if T is an array type).The transformed type is aliased as member type remove_extent::type.
If T is an array type, this is the same type as its elements. Otherwise, member type is the same as T.
Notice that, for multidimensional arrays, only the first array dimension is removed (see remove_all_extents to obtain the type of the elements in the deepest dimension).
This class merely obtains a type using another type as model, but it does not transform values or objects between those types.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// remove_extent
#include <iostream>
#include <type_traits>
int main() {
typedef std::remove_extent<int>::type A; // int
typedef std::remove_extent<int[24]>::type B; // int
typedef std::remove_extent<int[24][60]>::type C; // int[60]
typedef std::remove_extent<int[][60]>::type D; // int[60]
std::cout << std::boolalpha;
std::cout << "typedefs of int:" << std::endl;
std::cout << "A: " << std::is_same<int,A>::value << std::endl;
std::cout << "B: " << std::is_same<int,B>::value << std::endl;
std::cout << "C: " << std::is_same<int,C>::value << std::endl;
std::cout << "D: " << std::is_same<int,D>::value << std::endl;
return 0;
}
typedefs of int: A: true B: true C: false D: false
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4