1 /*-----------------------------------------------------------------------------+
2 Copyright (c) 2008-2009: Joachim Faulhaber
3 +------------------------------------------------------------------------------+
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENCE.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 +-----------------------------------------------------------------------------*/
8 #ifndef BOOST_ICL_TYPE_TRAITS_REP_TYPE_OF_HPP_JOFA_110329
9 #define BOOST_ICL_TYPE_TRAITS_REP_TYPE_OF_HPP_JOFA_110329
11 #include <boost/config.hpp> // For macro BOOST_STATIC_CONSTANT
12 #include <boost/mpl/has_xxx.hpp>
13 #include <boost/mpl/or.hpp>
14 #include <boost/mpl/and.hpp>
15 #include <boost/mpl/not.hpp>
16 #include <boost/icl/type_traits/no_type.hpp>
18 namespace boost{ namespace icl
22 BOOST_MPL_HAS_XXX_TRAIT_DEF(rep)
25 //--------------------------------------------------------------------------
28 : mpl::bool_<detail::has_rep<Type>::value>
31 template <class Rep, class Type>
32 struct represents // Rep represents Type; Type is_wrapper_of Rep
33 : mpl::bool_<detail::has_rep<Type>::value>
35 typedef represents type;
36 BOOST_STATIC_CONSTANT(bool,
37 value = (mpl::and_< has_rep_type<Type>
38 , is_same<typename Type::rep, Rep> >::value)
42 //--------------------------------------------------------------------------
43 template <class Type, bool has_rep>
47 struct get_rep_type<Type, false>
53 struct get_rep_type<Type, true>
55 typedef typename Type::rep type;
58 //--------------------------------------------------------------------------
63 get_rep_type<Type, has_rep_type<Type>::value>::type type;
66 }} // namespace boost icl