/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. #ifndef BOOST_MULTI_INDEX_DETAIL_UNBOUNDED_HPP
  9. #define BOOST_MULTI_INDEX_DETAIL_UNBOUNDED_HPP
  10. #if defined(_MSC_VER)&&(_MSC_VER>=1200)
  11. #pragma once
  12. #endif
  13. #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
  14. #include <boost/detail/workaround.hpp>
  15. namespace boost{
  16. namespace multi_index{
  17. /* dummy type and variable for use in ordered_index::range() */
  18. #if BOOST_WORKAROUND(BOOST_MSVC,<1300)
  19. /* The default branch actually works for MSVC 6.0, but seems like
  20. * this implementation of unbounded improves the performance of ordered
  21. * indices! This behavior is hard to explain and probably a test artifact,
  22. * but it does not hurt to have the workaround anyway.
  23. */
  24. namespace detail{struct unbounded_type{};}
  25. namespace{
  26. static detail::unbounded_type unbounded_obj=detail::unbounded_type();
  27. static detail::unbounded_type& unbounded=unbounded_obj;
  28. } /* unnamed */
  29. #else
  30. /* ODR-abiding technique shown at the example attached to
  31. * http://lists.boost.org/Archives/boost/2006/07/108355.php
  32. */
  33. namespace detail{class unbounded_helper;}
  34. detail::unbounded_helper unbounded(detail::unbounded_helper);
  35. namespace detail{
  36. class unbounded_helper
  37. {
  38. unbounded_helper(){}
  39. unbounded_helper(const unbounded_helper&){}
  40. friend unbounded_helper multi_index::unbounded(unbounded_helper);
  41. };
  42. typedef unbounded_helper (*unbounded_type)(unbounded_helper);
  43. } /* namespace multi_index::detail */
  44. inline detail::unbounded_helper unbounded(detail::unbounded_helper)
  45. {
  46. return detail::unbounded_helper();
  47. }
  48. #endif
  49. /* tags used in the implementation of range */
  50. namespace detail{
  51. struct none_unbounded_tag{};
  52. struct lower_unbounded_tag{};
  53. struct upper_unbounded_tag{};
  54. struct both_unbounded_tag{};
  55. } /* namespace multi_index::detail */
  56. } /* namespace multi_index */
  57. } /* namespace boost */
  58. #endif