1 | |
---|
2 | #ifndef BOOST_MPL_AUX_ORDER_IMPL_HPP_INCLUDED |
---|
3 | #define BOOST_MPL_AUX_ORDER_IMPL_HPP_INCLUDED |
---|
4 | |
---|
5 | // Copyright Aleksey Gurtovoy 2003-2004 |
---|
6 | // Copyright David Abrahams 2003-2004 |
---|
7 | // |
---|
8 | // Distributed under the Boost Software License, Version 1.0. |
---|
9 | // (See accompanying file LICENSE_1_0.txt or copy at |
---|
10 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
11 | // |
---|
12 | // See http://www.boost.org/libs/mpl for documentation. |
---|
13 | |
---|
14 | // $Id$ |
---|
15 | // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ |
---|
16 | // $Revision: 49267 $ |
---|
17 | |
---|
18 | #include <boost/mpl/order_fwd.hpp> |
---|
19 | #include <boost/mpl/if.hpp> |
---|
20 | #include <boost/mpl/long.hpp> |
---|
21 | #include <boost/mpl/has_key.hpp> |
---|
22 | #include <boost/mpl/aux_/overload_names.hpp> |
---|
23 | #include <boost/mpl/aux_/static_cast.hpp> |
---|
24 | #include <boost/mpl/aux_/type_wrapper.hpp> |
---|
25 | #include <boost/mpl/aux_/traits_lambda_spec.hpp> |
---|
26 | #include <boost/mpl/aux_/config/msvc.hpp> |
---|
27 | #include <boost/mpl/aux_/config/static_constant.hpp> |
---|
28 | #include <boost/mpl/aux_/config/workaround.hpp> |
---|
29 | |
---|
30 | namespace boost { namespace mpl { |
---|
31 | |
---|
32 | // default implementation; requires 'Seq' to provide corresponding overloads |
---|
33 | // of BOOST_MPL_AUX_OVERLOAD_ORDER_BY_KEY |
---|
34 | |
---|
35 | template< typename Seq, typename Key > struct x_order_impl |
---|
36 | #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ |
---|
37 | || BOOST_WORKAROUND(__EDG_VERSION__, <= 245) |
---|
38 | { |
---|
39 | BOOST_STATIC_CONSTANT(long, value = |
---|
40 | sizeof( BOOST_MPL_AUX_OVERLOAD_CALL_ORDER_BY_KEY( |
---|
41 | Seq |
---|
42 | , BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<Key>*, 0) |
---|
43 | ) ) |
---|
44 | ); |
---|
45 | |
---|
46 | typedef long_<value> type; |
---|
47 | |
---|
48 | #else // ISO98 C++ |
---|
49 | : long_< |
---|
50 | sizeof( BOOST_MPL_AUX_OVERLOAD_CALL_ORDER_BY_KEY( |
---|
51 | Seq |
---|
52 | , BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper<Key>*, 0) |
---|
53 | ) ) |
---|
54 | > |
---|
55 | { |
---|
56 | #endif |
---|
57 | }; |
---|
58 | |
---|
59 | template< typename Tag > |
---|
60 | struct order_impl |
---|
61 | { |
---|
62 | template< typename Seq, typename Key > struct apply |
---|
63 | : if_< |
---|
64 | typename has_key_impl<Tag>::template apply<Seq,Key> |
---|
65 | , x_order_impl<Seq,Key> |
---|
66 | , void_ |
---|
67 | >::type |
---|
68 | { |
---|
69 | }; |
---|
70 | }; |
---|
71 | |
---|
72 | BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(2,order_impl) |
---|
73 | |
---|
74 | }} |
---|
75 | |
---|
76 | #endif // BOOST_MPL_AUX_ORDER_IMPL_HPP_INCLUDED |
---|