39edf60a2ec7b0c58d04e730a81bb5a9952eb6d9
[senf.git] / boost / multi_index / detail / prevent_eti.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_PREVENT_ETI_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_PREVENT_ETI_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,<1300)
20 #include <boost/mpl/if.hpp>
21 #include <boost/mpl/integral_c.hpp>
22 #include <boost/mpl/aux_/msvc_never_true.hpp>
23 #endif
24
25 namespace boost{
26
27 namespace multi_index{
28
29 namespace detail{
30
31 #if BOOST_WORKAROUND(BOOST_MSVC,<1300)
32 /* See
33  * http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_MPL
34  * Item 5.6, Beware of the 'early template instantiation' trap.
35  */
36
37 template<typename Type,typename Construct>
38 struct prevent_eti
39 {
40   typedef typename mpl::if_<
41     mpl::aux::msvc_never_true<Type>,
42     mpl::integral_c<int,0>,
43     Construct
44   >::type type;
45 };
46 #else
47 template<typename Type,typename Construct>
48 struct prevent_eti
49 {
50   typedef Construct type;
51 };
52 #endif
53
54 } /* namespace multi_index::detail */
55
56 } /* namespace multi_index */
57
58 } /* namespace boost */
59
60 #endif