]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | (c) 2015 Glen Joseph Fernandes | |
3 | <glenjofe -at- gmail.com> | |
4 | ||
5 | Distributed under the Boost Software | |
6 | License, Version 1.0. | |
7 | http://boost.org/LICENSE_1_0.txt | |
8 | */ | |
9 | #ifndef BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP | |
10 | #define BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP | |
11 | ||
12 | #include <boost/config.hpp> | |
13 | ||
14 | #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) | |
15 | #include <type_traits> | |
16 | #else | |
17 | #include <cstddef> | |
18 | #endif | |
19 | ||
20 | namespace boost { | |
21 | namespace alignment { | |
22 | namespace detail { | |
23 | ||
24 | #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) | |
25 | using std::remove_reference; | |
26 | using std::remove_all_extents; | |
27 | using std::remove_cv; | |
28 | #else | |
29 | template<class T> | |
30 | struct remove_reference { | |
31 | typedef T type; | |
32 | }; | |
33 | ||
34 | template<class T> | |
35 | struct remove_reference<T&> { | |
36 | typedef T type; | |
37 | }; | |
38 | ||
39 | #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | |
40 | template<class T> | |
41 | struct remove_reference<T&&> { | |
42 | typedef T type; | |
43 | }; | |
44 | #endif | |
45 | ||
46 | template<class T> | |
47 | struct remove_all_extents { | |
48 | typedef T type; | |
49 | }; | |
50 | ||
51 | template<class T> | |
52 | struct remove_all_extents<T[]> | |
53 | : remove_all_extents<T> { }; | |
54 | ||
55 | template<class T, std::size_t N> | |
56 | struct remove_all_extents<T[N]> | |
57 | : remove_all_extents<T> { }; | |
58 | ||
59 | template<class T> | |
60 | struct remove_const { | |
61 | typedef T type; | |
62 | }; | |
63 | ||
64 | template<class T> | |
65 | struct remove_const<const T> { | |
66 | typedef T type; | |
67 | }; | |
68 | ||
69 | template<class T> | |
70 | struct remove_volatile { | |
71 | typedef T type; | |
72 | }; | |
73 | ||
74 | template<class T> | |
75 | struct remove_volatile<volatile T> { | |
76 | typedef T type; | |
77 | }; | |
78 | ||
79 | template<class T> | |
80 | struct remove_cv | |
81 | : remove_volatile<typename remove_const<T>::type> { }; | |
82 | #endif | |
83 | ||
84 | template<class T> | |
85 | struct element_type | |
86 | : remove_cv<typename remove_all_extents<typename | |
87 | remove_reference<T>::type>::type> { }; | |
88 | ||
89 | } /* .detail */ | |
90 | } /* .alignment */ | |
91 | } /* .boost */ | |
92 | ||
93 | #endif |