Add SCons configure checks
[senf.git] / boost_ext / boost / multi_index / detail / unbounded.hpp
1 /* Copyright 2003-2007 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_UNBOUNDED_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_UNBOUNDED_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 namespace boost{
20
21 namespace multi_index{
22
23 /* dummy type and variable for use in ordered_index::range() */
24
25 #if BOOST_WORKAROUND(BOOST_MSVC,<1300)
26 /* The default branch actually works for MSVC 6.0, but seems like
27  * this implementation of unbounded improves the performance of ordered
28  * indices! This behavior is hard to explain and probably a test artifact,
29  * but it does not hurt to have the workaround anyway.
30  */
31
32 namespace detail{struct unbounded_type{};}
33
34 namespace{
35
36 static detail::unbounded_type  unbounded_obj=detail::unbounded_type();
37 static detail::unbounded_type& unbounded=unbounded_obj;
38
39 } /* unnamed */
40 #else
41 /* ODR-abiding technique shown at the example attached to
42  * http://lists.boost.org/Archives/boost/2006/07/108355.php
43  */
44
45 namespace detail{class unbounded_helper;}
46
47 detail::unbounded_helper unbounded(detail::unbounded_helper);
48
49 namespace detail{
50
51 class unbounded_helper
52 {
53   unbounded_helper(){}
54   unbounded_helper(const unbounded_helper&){}
55   friend unbounded_helper multi_index::unbounded(unbounded_helper);
56 };
57
58 typedef unbounded_helper (*unbounded_type)(unbounded_helper);
59
60 } /* namespace multi_index::detail */
61
62 inline detail::unbounded_helper unbounded(detail::unbounded_helper)
63 {
64   return detail::unbounded_helper();
65 }
66 #endif
67
68 /* tags used in the implementation of range */
69
70 namespace detail{
71
72 struct none_unbounded_tag{};
73 struct lower_unbounded_tag{};
74 struct upper_unbounded_tag{};
75 struct both_unbounded_tag{};
76
77 } /* namespace multi_index::detail */
78
79 } /* namespace multi_index */
80
81 } /* namespace boost */
82
83 #endif