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/type_traits/is_same.hpp>
17 #include <boost/icl/type_traits/no_type.hpp>
19 namespace boost{ namespace icl
23 BOOST_MPL_HAS_XXX_TRAIT_DEF(rep)
26 //--------------------------------------------------------------------------
29 : mpl::bool_<detail::has_rep<Type>::value>
32 template <class Rep, class Type>
33 struct represents // Rep represents Type; Type is_wrapper_of Rep
34 : mpl::bool_<detail::has_rep<Type>::value>
36 typedef represents type;
37 BOOST_STATIC_CONSTANT(bool,
38 value = (mpl::and_< has_rep_type<Type>
39 , boost::is_same<typename Type::rep, Rep> >::value)
43 //--------------------------------------------------------------------------
44 template <class Type, bool has_rep>
48 struct get_rep_type<Type, false>
54 struct get_rep_type<Type, true>
56 typedef typename Type::rep type;
59 //--------------------------------------------------------------------------
64 get_rep_type<Type, has_rep_type<Type>::value>::type type;
67 }} // namespace boost icl