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)
6 * See http://www.boost.org/libs/multi_index for library home page.
9 #ifndef BOOST_MULTI_INDEX_DETAIL_UNBOUNDED_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_UNBOUNDED_HPP
12 #if defined(_MSC_VER)&&(_MSC_VER>=1200)
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17 #include <boost/detail/workaround.hpp>
21 namespace multi_index{
23 /* dummy type and variable for use in ordered_index::range() */
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.
32 namespace detail{struct unbounded_type{};}
36 static detail::unbounded_type unbounded_obj=detail::unbounded_type();
37 static detail::unbounded_type& unbounded=unbounded_obj;
41 /* ODR-abiding technique shown at the example attached to
42 * http://lists.boost.org/Archives/boost/2006/07/108355.php
45 namespace detail{class unbounded_helper;}
47 detail::unbounded_helper unbounded(detail::unbounded_helper);
51 class unbounded_helper
54 unbounded_helper(const unbounded_helper&){}
55 friend unbounded_helper multi_index::unbounded(unbounded_helper);
58 typedef unbounded_helper (*unbounded_type)(unbounded_helper);
60 } /* namespace multi_index::detail */
62 inline detail::unbounded_helper unbounded(detail::unbounded_helper)
64 return detail::unbounded_helper();
68 /* tags used in the implementation of range */
72 struct none_unbounded_tag{};
73 struct lower_unbounded_tag{};
74 struct upper_unbounded_tag{};
75 struct both_unbounded_tag{};
77 } /* namespace multi_index::detail */
79 } /* namespace multi_index */
81 } /* namespace boost */