unbounded.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #ifndef BOOST_MULTI_INDEX_DETAIL_UNBOUNDED_HPP
  9. #define BOOST_MULTI_INDEX_DETAIL_UNBOUNDED_HPP
  10. #if defined(_MSC_VER)
  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. /* ODR-abiding technique shown at the example attached to
  19. * http://lists.boost.org/Archives/boost/2006/07/108355.php
  20. */
  21. namespace detail{class unbounded_helper;}
  22. detail::unbounded_helper unbounded(detail::unbounded_helper);
  23. namespace detail{
  24. class unbounded_helper
  25. {
  26. unbounded_helper(){}
  27. unbounded_helper(const unbounded_helper&){}
  28. friend unbounded_helper multi_index::unbounded(unbounded_helper);
  29. };
  30. typedef unbounded_helper (*unbounded_type)(unbounded_helper);
  31. } /* namespace multi_index::detail */
  32. inline detail::unbounded_helper unbounded(detail::unbounded_helper)
  33. {
  34. return detail::unbounded_helper();
  35. }
  36. /* tags used in the implementation of range */
  37. namespace detail{
  38. struct none_unbounded_tag{};
  39. struct lower_unbounded_tag{};
  40. struct upper_unbounded_tag{};
  41. struct both_unbounded_tag{};
  42. } /* namespace multi_index::detail */
  43. } /* namespace multi_index */
  44. } /* namespace boost */
  45. #endif