1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2005-2008.
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/interprocess for documentation.
11 //////////////////////////////////////////////////////////////////////////////
13 #ifndef BOOST_INTERPROCESS_DETAIL_MPL_HPP
14 #define BOOST_INTERPROCESS_DETAIL_MPL_HPP
16 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
23 namespace interprocess
{
26 template <class T
, T val
>
27 struct integral_constant
29 static const T value
= val
;
30 typedef integral_constant
<T
,val
> type
;
34 struct bool_
: integral_constant
<bool, C_
>
36 static const bool value
= C_
;
39 typedef bool_
<true> true_
;
40 typedef bool_
<false> false_
;
42 typedef true_ true_type
;
43 typedef false_ false_type
;
45 typedef char yes_type
;
51 template <bool B
, class T
= void>
57 struct enable_if_c
<false, T
> {};
59 template <class Cond
, class T
= void>
60 struct enable_if
: public enable_if_c
<Cond::value
, T
> {};
62 template <class Cond
, class T
= void>
63 struct disable_if
: public enable_if_c
<!Cond::value
, T
> {};
65 template <class T
, class U
>
69 class false_t
{ char dummy
[2]; };
70 static true_t
dispatch(U
);
71 static false_t
dispatch(...);
74 enum { value
= sizeof(dispatch(trigger())) == sizeof(true_t
) };
91 struct if_c
<false,T1
,T2
>
103 typedef typename if_c
<0 != T1::value
, T2
, T3
>::type type
;
107 template <class Pair
>
109 // : public std::unary_function<Pair, typename Pair::first_type>
111 template<class OtherPair
>
112 const typename
Pair::first_type
& operator()(const OtherPair
& x
) const
115 const typename
Pair::first_type
& operator()(const typename
Pair::first_type
& x
) const
119 // identity is an extension: it is not part of the standard.
122 // : public std::unary_function<T,T>
125 const T
& operator()(const T
& x
) const
129 template<std::size_t S
>
132 static const std::size_t value
= (S
& std::size_t(1)) ? 0 : (1u + ls_zeros
<(S
>> 1u)>::value
);
138 static const std::size_t value
= 0;
144 static const std::size_t value
= 0;
147 } //namespace detail {
148 } //namespace interprocess {
149 } //namespace boost {
151 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_MPL_HPP