1 /* Copyright 2003-2008 Joaquin M Lopez Munoz.
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)
6 * See http://www.boost.org/libs/multi_index for library home page.
9 #ifndef BOOST_MULTI_INDEX_DETAIL_BASE_TYPE_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_BASE_TYPE_HPP
12 #if defined(_MSC_VER)&&(_MSC_VER>=1200)
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17 #include <boost/detail/workaround.hpp>
18 #include <boost/mpl/at.hpp>
19 #include <boost/mpl/apply.hpp>
20 #include <boost/mpl/size.hpp>
21 #include <boost/multi_index/detail/index_base.hpp>
22 #include <boost/multi_index/detail/is_index_list.hpp>
23 #include <boost/multi_index/detail/msvc_index_specifier.hpp>
24 #include <boost/static_assert.hpp>
28 namespace multi_index
{
32 /* MPL machinery to construct a linear hierarchy of indices out of
36 #if BOOST_WORKAROUND(BOOST_MSVC,<1310)
39 template<typename IndexSpecifierMeta
,typename SuperMeta
>
41 msvc_index_specifier
<IndexSpecifierMeta::type
>::
42 template result_index_class
<SuperMeta
>
49 template<typename IndexSpecifierMeta
,typename SuperMeta
>
52 typedef typename
IndexSpecifierMeta::type index_specifier
;
53 typedef typename
index_specifier::
54 BOOST_NESTED_TEMPLATE index_class
<SuperMeta
>::type type
;
59 template<int N
,typename Value
,typename IndexSpecifierList
,typename Allocator
>
62 BOOST_STATIC_CONSTANT(int,length
=mpl::size
<IndexSpecifierList
>::value
);
64 typedef typename
mpl::eval_if_c
<
66 mpl::identity
<index_base
<Value
,IndexSpecifierList
,Allocator
> >,
69 mpl::at_c
<IndexSpecifierList
,N
>,
70 nth_layer
<N
+1,Value
,IndexSpecifierList
,Allocator
>
75 template<typename Value
,typename IndexSpecifierList
,typename Allocator
>
76 struct multi_index_base_type
:nth_layer
<0,Value
,IndexSpecifierList
,Allocator
>
78 BOOST_STATIC_ASSERT(detail::is_index_list
<IndexSpecifierList
>::value
);
81 } /* namespace multi_index::detail */
83 } /* namespace multi_index */
85 } /* namespace boost */