stack.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_STACK_HPP
  11. #define BOOST_ASSIGN_STD_STACK_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 <stack>
  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::stack<V,C> >, V >
  26. operator+=( std::stack<V,C>& c, V2 v )
  27. {
  28. return push( c )( v );
  29. }
  30. #else
  31. template< class V, class C, class V2 >
  32. inline list_inserter< assign_detail::call_push< std::stack<V, C> >, V >
  33. operator+=(std::stack<V, C>& c, V2&& v)
  34. {
  35. return push(c)(boost::forward<V2>(v));
  36. }
  37. #endif
  38. }
  39. }
  40. #endif