source: NonGTP/Boost/boost/multi_index/detail/node_type.hpp @ 857

Revision 857, 2.2 KB checked in by igarcia, 18 years ago (diff)
Line 
1/* Copyright 2003-2005 Joaquín M López Muñoz.
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)&&(_MSC_VER>=1200)
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/multi_index/detail/msvc_index_specifier.hpp>
26#include <boost/static_assert.hpp>
27
28namespace boost{
29
30namespace multi_index{
31
32namespace detail{
33
34/* MPL machinery to construct the internal node type associated to an
35 * index list.
36 */
37
38#if BOOST_WORKAROUND(BOOST_MSVC,<1310)
39struct index_node_applier
40{
41  template<typename IndexSpecifierIterator,typename Super>
42  struct apply:
43    msvc_index_specifier< mpl::deref<IndexSpecifierIterator>::type >::
44      template result_node_class<Super>
45  {
46  };
47};
48#else
49struct index_node_applier
50{
51  template<typename IndexSpecifierIterator,typename Super>
52  struct apply
53  {
54    typedef typename mpl::deref<IndexSpecifierIterator>::type index_specifier;
55    typedef typename index_specifier::
56      BOOST_NESTED_TEMPLATE node_class<Super>::type type;
57  };
58};
59#endif
60
61template<typename Value,typename IndexSpecifierList,typename Allocator>
62struct multi_index_node_type
63{
64  BOOST_STATIC_ASSERT(detail::is_index_list<IndexSpecifierList>::value);
65
66  typedef typename mpl::reverse_iter_fold<
67    IndexSpecifierList,
68    index_node_base<Value>,
69    mpl::bind2<index_node_applier,mpl::_2,mpl::_1>
70  >::type type;
71};
72
73} /* namespace multi_index::detail */
74
75} /* namespace multi_index */
76
77} /* namespace boost */
78
79#endif
Note: See TracBrowser for help on using the repository browser.