1 /* Copyright 2003-2013 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
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/static_assert.hpp>
27 namespace multi_index{
31 /* MPL machinery to construct a linear hierarchy of indices out of
37 template<typename IndexSpecifierMeta,typename SuperMeta>
40 typedef typename IndexSpecifierMeta::type index_specifier;
41 typedef typename index_specifier::
42 BOOST_NESTED_TEMPLATE index_class<SuperMeta>::type type;
46 template<int N,typename Value,typename IndexSpecifierList,typename Allocator>
49 BOOST_STATIC_CONSTANT(int,length=mpl::size<IndexSpecifierList>::value);
51 typedef typename mpl::eval_if_c<
53 mpl::identity<index_base<Value,IndexSpecifierList,Allocator> >,
56 mpl::at_c<IndexSpecifierList,N>,
57 nth_layer<N+1,Value,IndexSpecifierList,Allocator>
62 template<typename Value,typename IndexSpecifierList,typename Allocator>
63 struct multi_index_base_type:nth_layer<0,Value,IndexSpecifierList,Allocator>
65 BOOST_STATIC_ASSERT(detail::is_index_list<IndexSpecifierList>::value);
68 } /* namespace multi_index::detail */
70 } /* namespace multi_index */
72 } /* namespace boost */