]>
Commit | Line | Data |
---|---|---|
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) | |
5 | * | |
6 | * See http://www.boost.org/libs/multi_index for library home page. | |
7 | */ | |
8 | ||
9 | #ifndef BOOST_MULTI_INDEX_DETAIL_NODE_TYPE_HPP | |
10 | #define BOOST_MULTI_INDEX_DETAIL_NODE_TYPE_HPP | |
11 | ||
12 | #if defined(_MSC_VER) | |
13 | #pragma once | |
14 | #endif | |
15 | ||
16 | #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ | |
17 | #include <boost/detail/workaround.hpp> | |
18 | #include <boost/mpl/bind.hpp> | |
19 | #include <boost/mpl/reverse_iter_fold.hpp> | |
20 | #include <boost/mpl/deref.hpp> | |
21 | #include <boost/multi_index_container_fwd.hpp> | |
22 | #include <boost/multi_index/detail/header_holder.hpp> | |
23 | #include <boost/multi_index/detail/index_node_base.hpp> | |
24 | #include <boost/multi_index/detail/is_index_list.hpp> | |
25 | #include <boost/static_assert.hpp> | |
26 | ||
27 | namespace boost{ | |
28 | ||
29 | namespace multi_index{ | |
30 | ||
31 | namespace detail{ | |
32 | ||
33 | /* MPL machinery to construct the internal node type associated to an | |
34 | * index list. | |
35 | */ | |
36 | ||
37 | struct index_node_applier | |
38 | { | |
39 | template<typename IndexSpecifierIterator,typename Super> | |
40 | struct apply | |
41 | { | |
42 | typedef typename mpl::deref<IndexSpecifierIterator>::type index_specifier; | |
43 | typedef typename index_specifier:: | |
44 | BOOST_NESTED_TEMPLATE node_class<Super>::type type; | |
45 | }; | |
46 | }; | |
47 | ||
48 | template<typename Value,typename IndexSpecifierList,typename Allocator> | |
49 | struct multi_index_node_type | |
50 | { | |
51 | BOOST_STATIC_ASSERT(detail::is_index_list<IndexSpecifierList>::value); | |
52 | ||
53 | typedef typename mpl::reverse_iter_fold< | |
54 | IndexSpecifierList, | |
55 | index_node_base<Value,Allocator>, | |
56 | mpl::bind2<index_node_applier,mpl::_2,mpl::_1> | |
57 | >::type type; | |
58 | }; | |
59 | ||
60 | } /* namespace multi_index::detail */ | |
61 | ||
62 | } /* namespace multi_index */ | |
63 | ||
64 | } /* namespace boost */ | |
65 | ||
66 | #endif |