1 | |
---|
2 | // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. |
---|
3 | // Use, modification and distribution are subject to the Boost Software License, |
---|
4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
---|
5 | // http://www.boost.org/LICENSE_1_0.txt). |
---|
6 | // |
---|
7 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. |
---|
8 | |
---|
9 | #ifndef BOOST_TT_ADD_POINTER_HPP_INCLUDED |
---|
10 | #define BOOST_TT_ADD_POINTER_HPP_INCLUDED |
---|
11 | |
---|
12 | #include <boost/type_traits/remove_reference.hpp> |
---|
13 | |
---|
14 | // should be the last #include |
---|
15 | #include <boost/type_traits/detail/type_trait_def.hpp> |
---|
16 | |
---|
17 | namespace boost { |
---|
18 | |
---|
19 | namespace detail { |
---|
20 | |
---|
21 | #if defined(__BORLANDC__) && (__BORLANDC__ < 0x5A0) |
---|
22 | // |
---|
23 | // For some reason this implementation stops Borlands compiler |
---|
24 | // from dropping cv-qualifiers, it still fails with references |
---|
25 | // to arrays for some reason though (shrug...) (JM 20021104) |
---|
26 | // |
---|
27 | template <typename T> |
---|
28 | struct add_pointer_impl |
---|
29 | { |
---|
30 | typedef T* type; |
---|
31 | }; |
---|
32 | template <typename T> |
---|
33 | struct add_pointer_impl<T&> |
---|
34 | { |
---|
35 | typedef T* type; |
---|
36 | }; |
---|
37 | template <typename T> |
---|
38 | struct add_pointer_impl<T&const> |
---|
39 | { |
---|
40 | typedef T* type; |
---|
41 | }; |
---|
42 | template <typename T> |
---|
43 | struct add_pointer_impl<T&volatile> |
---|
44 | { |
---|
45 | typedef T* type; |
---|
46 | }; |
---|
47 | template <typename T> |
---|
48 | struct add_pointer_impl<T&const volatile> |
---|
49 | { |
---|
50 | typedef T* type; |
---|
51 | }; |
---|
52 | |
---|
53 | #else |
---|
54 | |
---|
55 | template <typename T> |
---|
56 | struct add_pointer_impl |
---|
57 | { |
---|
58 | typedef typename remove_reference<T>::type no_ref_type; |
---|
59 | typedef no_ref_type* type; |
---|
60 | }; |
---|
61 | |
---|
62 | #endif |
---|
63 | |
---|
64 | } // namespace detail |
---|
65 | |
---|
66 | BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_pointer,T,typename boost::detail::add_pointer_impl<T>::type) |
---|
67 | |
---|
68 | } // namespace boost |
---|
69 | |
---|
70 | #include <boost/type_traits/detail/type_trait_undef.hpp> |
---|
71 | |
---|
72 | #endif // BOOST_TT_ADD_POINTER_HPP_INCLUDED |
---|