set_adaptor.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // Boost.Bimap
  2. //
  3. // Copyright (c) 2006-2007 Matias Capeletto
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. /// \file container_adaptor/set_adaptor.hpp
  9. /// \brief Container adaptor to easily build a std::set signature compatible container.
  10. #ifndef BOOST_BIMAP_CONTAINER_ADAPTOR_SET_ADAPTOR_HPP
  11. #define BOOST_BIMAP_CONTAINER_ADAPTOR_SET_ADAPTOR_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/bimap/container_adaptor/ordered_associative_container_adaptor.hpp>
  17. #include <boost/mpl/vector.hpp>
  18. #include <boost/mpl/aux_/na.hpp>
  19. namespace boost {
  20. namespace bimaps {
  21. namespace container_adaptor {
  22. /// \brief Container adaptor to easily build a std::set signature compatible container.
  23. template
  24. <
  25. class Base,
  26. class Iterator,
  27. class ConstIterator,
  28. class ReverseIterator,
  29. class ConstReverseIterator,
  30. class IteratorToBaseConverter = ::boost::mpl::na,
  31. class IteratorFromBaseConverter = ::boost::mpl::na,
  32. class ReverseIteratorFromBaseConverter = ::boost::mpl::na,
  33. class ValueToBaseConverter = ::boost::mpl::na,
  34. class ValueFromBaseConverter = ::boost::mpl::na,
  35. class KeyToBaseConverter = ::boost::mpl::na,
  36. class FunctorsFromDerivedClasses = mpl::vector<>
  37. >
  38. class set_adaptor :
  39. public ::boost::bimaps::container_adaptor::
  40. ordered_associative_container_adaptor
  41. <
  42. Base,
  43. Iterator, ConstIterator, ReverseIterator, ConstReverseIterator,
  44. BOOST_DEDUCED_TYPENAME Iterator::value_type,
  45. IteratorToBaseConverter, IteratorFromBaseConverter,
  46. ReverseIteratorFromBaseConverter,
  47. ValueToBaseConverter, ValueFromBaseConverter,
  48. KeyToBaseConverter,
  49. FunctorsFromDerivedClasses
  50. >
  51. {
  52. typedef ::boost::bimaps::container_adaptor::
  53. ordered_associative_container_adaptor
  54. <
  55. Base,
  56. Iterator, ConstIterator, ReverseIterator, ConstReverseIterator,
  57. BOOST_DEDUCED_TYPENAME Iterator::value_type,
  58. IteratorToBaseConverter, IteratorFromBaseConverter,
  59. ReverseIteratorFromBaseConverter,
  60. ValueToBaseConverter, ValueFromBaseConverter,
  61. KeyToBaseConverter,
  62. FunctorsFromDerivedClasses
  63. > base_;
  64. // Access -----------------------------------------------------------------
  65. public:
  66. explicit set_adaptor(Base & c) :
  67. base_(c) {}
  68. protected:
  69. typedef set_adaptor set_adaptor_;
  70. };
  71. } // namespace container_adaptor
  72. } // namespace bimaps
  73. } // namespace boost
  74. #endif // BOOST_BIMAP_CONTAINER_ADAPTOR_SET_ADAPTOR_HPP