| 1 | // Copyright Daniel Wallin, David Abrahams 2010. |
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 4 | // http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #ifndef BOOST_PARAMETER_IS_MAYBE_050329_HPP |
| 7 | #define BOOST_PARAMETER_IS_MAYBE_050329_HPP |
| 8 | |
| 9 | namespace boost { namespace parameter { namespace aux { |
| 10 | |
| 11 | struct maybe_base |
| 12 | { |
| 13 | }; |
| 14 | }}} // namespace boost::parameter::aux |
| 15 | |
| 16 | #if defined(BOOST_PARAMETER_CAN_USE_MP11) |
| 17 | #include <type_traits> |
| 18 | |
| 19 | namespace boost { namespace parameter { namespace aux { |
| 20 | |
| 21 | template <typename T> |
| 22 | using is_maybe = ::std::is_base_of< |
| 23 | ::boost::parameter::aux::maybe_base |
| 24 | , typename ::std::remove_const<T>::type |
| 25 | >; |
| 26 | }}} // namespace boost::parameter::aux |
| 27 | |
| 28 | #else // !defined(BOOST_PARAMETER_CAN_USE_MP11) |
| 29 | #include <boost/mpl/bool.hpp> |
| 30 | #include <boost/mpl/if.hpp> |
| 31 | #include <boost/type_traits/is_base_of.hpp> |
| 32 | #include <boost/type_traits/remove_const.hpp> |
| 33 | |
| 34 | namespace boost { namespace parameter { namespace aux { |
| 35 | |
| 36 | template <typename T> |
| 37 | struct is_maybe |
| 38 | : ::boost::mpl::if_< |
| 39 | ::boost::is_base_of< |
| 40 | ::boost::parameter::aux::maybe_base |
| 41 | , typename ::boost::remove_const<T>::type |
| 42 | > |
| 43 | , ::boost::mpl::true_ |
| 44 | , ::boost::mpl::false_ |
| 45 | >::type |
| 46 | { |
| 47 | }; |
| 48 | }}} // namespace boost::parameter::aux |
| 49 | |
| 50 | #endif // BOOST_PARAMETER_CAN_USE_MP11 |
| 51 | #endif // include guard |
| 52 | |
| 53 | |