queue.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Boost.Assign library
  2. //
  3. // Copyright Thorsten Ottosen 2003-2004. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // For more information, see http://www.boost.org/libs/assign/
  9. //
  10. #ifndef BOOST_ASSIGN_STD_QUEUE_HPP
  11. #define BOOST_ASSIGN_STD_QUEUE_HPP
  12. #if defined(_MSC_VER)
  13. # pragma once
  14. #endif
  15. #include <boost/assign/list_inserter.hpp>
  16. #include <boost/config.hpp>
  17. #include <boost/move/utility.hpp>
  18. #include <queue>
  19. namespace boost
  20. {
  21. namespace assign
  22. {
  23. #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
  24. template< class V, class C, class V2 >
  25. inline list_inserter< assign_detail::call_push< std::queue<V,C> >, V >
  26. operator+=( std::queue<V,C>& c, V2 v )
  27. {
  28. return push( c )( v );
  29. }
  30. template< class V, class C, class V2 >
  31. inline list_inserter< assign_detail::call_push< std::priority_queue<V,C> >, V >
  32. operator+=( std::priority_queue<V,C>& c, V2 v )
  33. {
  34. return push( c )( v );
  35. }
  36. #else
  37. template< class V, class C, class V2 >
  38. inline list_inserter< assign_detail::call_push< std::queue<V, C> >, V >
  39. operator+=(std::queue<V, C>& c, V2&& v)
  40. {
  41. return push(c)(boost::forward<V2>(v));
  42. }
  43. template< class V, class C, class V2 >
  44. inline list_inserter< assign_detail::call_push< std::priority_queue<V, C> >, V >
  45. operator+=(std::priority_queue<V, C>& c, V2&& v)
  46. {
  47. return push(c)(boost::forward<V2>(v));
  48. }
  49. #endif
  50. }
  51. }
  52. #endif