Pack required boost code together.
[xy_vsfilter.git] / src / thirdparty / boost_1_47_0 / boost / multi_index / detail / base_type.hpp
blob9db6c63d8ca4107f0d270199dcc0cbeb9ca7fe16
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.
7 */
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)
13 #pragma once
14 #endif
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>
26 namespace boost{
28 namespace multi_index{
30 namespace detail{
32 /* MPL machinery to construct a linear hierarchy of indices out of
33 * a index list.
36 #if BOOST_WORKAROUND(BOOST_MSVC,<1310)
37 struct index_applier
39 template<typename IndexSpecifierMeta,typename SuperMeta>
40 struct apply:
41 msvc_index_specifier<IndexSpecifierMeta::type>::
42 template result_index_class<SuperMeta>
44 };
46 #else
47 struct index_applier
49 template<typename IndexSpecifierMeta,typename SuperMeta>
50 struct apply
52 typedef typename IndexSpecifierMeta::type index_specifier;
53 typedef typename index_specifier::
54 BOOST_NESTED_TEMPLATE index_class<SuperMeta>::type type;
55 };
57 #endif
59 template<int N,typename Value,typename IndexSpecifierList,typename Allocator>
60 struct nth_layer
62 BOOST_STATIC_CONSTANT(int,length=mpl::size<IndexSpecifierList>::value);
64 typedef typename mpl::eval_if_c<
65 N==length,
66 mpl::identity<index_base<Value,IndexSpecifierList,Allocator> >,
67 mpl::apply2<
68 index_applier,
69 mpl::at_c<IndexSpecifierList,N>,
70 nth_layer<N+1,Value,IndexSpecifierList,Allocator>
72 >::type type;
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 */
87 #endif