Line | |
---|
1 | // (C) Copyright John Maddock & Thorsten Ottosen 2005. |
---|
2 | // Use, modification and distribution are subject to the Boost Software License, |
---|
3 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
---|
4 | // http://www.boost.org/LICENSE_1_0.txt). |
---|
5 | // |
---|
6 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. |
---|
7 | |
---|
8 | |
---|
9 | #ifndef BOOST_TT_DECAY_HPP_INCLUDED |
---|
10 | #define BOOST_TT_DECAY_HPP_INCLUDED |
---|
11 | |
---|
12 | #include <boost/type_traits/config.hpp> |
---|
13 | #include <boost/type_traits/is_array.hpp> |
---|
14 | #include <boost/type_traits/is_function.hpp> |
---|
15 | #include <boost/type_traits/remove_bounds.hpp> |
---|
16 | #include <boost/type_traits/add_pointer.hpp> |
---|
17 | #include <boost/type_traits/remove_reference.hpp> |
---|
18 | #include <boost/mpl/eval_if.hpp> |
---|
19 | #include <boost/mpl/identity.hpp> |
---|
20 | |
---|
21 | namespace boost |
---|
22 | { |
---|
23 | |
---|
24 | template< class T > |
---|
25 | struct decay |
---|
26 | { |
---|
27 | private: |
---|
28 | typedef BOOST_DEDUCED_TYPENAME remove_reference<T>::type Ty; |
---|
29 | public: |
---|
30 | typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< |
---|
31 | is_array<Ty>, |
---|
32 | mpl::identity<BOOST_DEDUCED_TYPENAME remove_bounds<Ty>::type*>, |
---|
33 | BOOST_DEDUCED_TYPENAME mpl::eval_if< |
---|
34 | is_function<Ty>, |
---|
35 | add_pointer<Ty>, |
---|
36 | mpl::identity<Ty> |
---|
37 | > |
---|
38 | >::type type; |
---|
39 | }; |
---|
40 | |
---|
41 | } // namespace boost |
---|
42 | |
---|
43 | |
---|
44 | #endif // BOOST_TT_DECAY_HPP_INCLUDED |
---|
Note: See
TracBrowser
for help on using the repository browser.