694e866f7310649f9f12add83081b4ddc9b5e076
[senf.git] / boost / multi_index / detail / msvc_index_specifier.hpp
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_MSVC_INDEX_SPECIFIER_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_MSVC_INDEX_SPECIFIER_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
19 #if BOOST_WORKAROUND(BOOST_MSVC,<1310)
20 /* Workaround for a problem in MSVC with dependent template typedefs
21  * when accesing index specifiers.
22  * Modeled after <boost/mpl/aux_/msvc_dtw.hpp> (thanks, Aleksey!)
23  */
24
25 #include <boost/mpl/aux_/msvc_never_true.hpp>
26
27 namespace boost{
28
29 namespace multi_index{
30
31 namespace detail{
32
33 template<typename IndexSpecifier>
34 struct msvc_index_specifier
35 {
36   template<bool> struct fake_index_type:IndexSpecifier{};
37   template<> struct fake_index_type<true>
38   {
39     template<typename Super>
40     struct node_class{};
41
42     template<typename Super>
43     struct index_class{};
44   };
45
46   template<typename Super>
47   struct result_node_class:
48     fake_index_type<mpl::aux::msvc_never_true<IndexSpecifier>::value>::
49       template node_class<Super>
50   {
51   };
52
53   template<typename Super>
54   struct result_index_class:
55     fake_index_type<mpl::aux::msvc_never_true<IndexSpecifier>::value>::
56       template index_class<Super>
57   {
58   };
59 };
60
61 } /* namespace multi_index::detail */
62
63 } /* namespace multi_index */
64
65 } /* namespace boost */
66
67 #endif /* workaround */
68
69 #endif