Brian Silverman | 3cbbaca | 2018-08-04 23:38:07 -0700 | [diff] [blame^] | 1 | /* Copyright 2003-2013 Joaquin M Lopez Munoz. |
| 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) |
| 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 | /* ODR-abiding technique shown at the example attached to |
| 26 | * http://lists.boost.org/Archives/boost/2006/07/108355.php |
| 27 | */ |
| 28 | |
| 29 | namespace detail{class unbounded_helper;} |
| 30 | |
| 31 | detail::unbounded_helper unbounded(detail::unbounded_helper); |
| 32 | |
| 33 | namespace detail{ |
| 34 | |
| 35 | class unbounded_helper |
| 36 | { |
| 37 | unbounded_helper(){} |
| 38 | unbounded_helper(const unbounded_helper&){} |
| 39 | friend unbounded_helper multi_index::unbounded(unbounded_helper); |
| 40 | }; |
| 41 | |
| 42 | typedef unbounded_helper (*unbounded_type)(unbounded_helper); |
| 43 | |
| 44 | } /* namespace multi_index::detail */ |
| 45 | |
| 46 | inline detail::unbounded_helper unbounded(detail::unbounded_helper) |
| 47 | { |
| 48 | return detail::unbounded_helper(); |
| 49 | } |
| 50 | |
| 51 | /* tags used in the implementation of range */ |
| 52 | |
| 53 | namespace detail{ |
| 54 | |
| 55 | struct none_unbounded_tag{}; |
| 56 | struct lower_unbounded_tag{}; |
| 57 | struct upper_unbounded_tag{}; |
| 58 | struct both_unbounded_tag{}; |
| 59 | |
| 60 | } /* namespace multi_index::detail */ |
| 61 | |
| 62 | } /* namespace multi_index */ |
| 63 | |
| 64 | } /* namespace boost */ |
| 65 | |
| 66 | #endif |