PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/multi_index/detail/unbounded.hpp

http://hadesmem.googlecode.com/
C++ Header | 83 lines | 41 code | 25 blank | 17 comment | 0 complexity | 095aa63431a9e1791ee6dedf9fe60de5 MD5 | raw file
 1/* Copyright 2003-2008 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)&&(_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
19namespace boost{
20
21namespace 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
32namespace detail{struct unbounded_type{};}
33
34namespace{
35
36static detail::unbounded_type  unbounded_obj=detail::unbounded_type();
37static 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
45namespace detail{class unbounded_helper;}
46
47detail::unbounded_helper unbounded(detail::unbounded_helper);
48
49namespace detail{
50
51class unbounded_helper
52{
53  unbounded_helper(){}
54  unbounded_helper(const unbounded_helper&){}
55  friend unbounded_helper multi_index::unbounded(unbounded_helper);
56};
57
58typedef unbounded_helper (*unbounded_type)(unbounded_helper);
59
60} /* namespace multi_index::detail */
61
62inline 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
70namespace detail{
71
72struct none_unbounded_tag{};
73struct lower_unbounded_tag{};
74struct upper_unbounded_tag{};
75struct both_unbounded_tag{};
76
77} /* namespace multi_index::detail */
78
79} /* namespace multi_index */
80
81} /* namespace boost */
82
83#endif