move.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // (C) Copyright Daniel Wallin 2004.
  2. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
  4. // Contains the definitions of the class template move_source and the function
  5. // template move, which together make move pointers moveable.
  6. #ifndef BOOST_MOVE_HPP_INCLUDED
  7. #define BOOST_MOVE_HPP_INCLUDED
  8. namespace boost { namespace ptr_container_detail {
  9. namespace move_ptrs {
  10. #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
  11. #pragma warning(push)
  12. #pragma warning(disable:4512)
  13. #endif
  14. template<typename Ptr>
  15. class move_source {
  16. public:
  17. move_source(Ptr& ptr) : ptr_(ptr) {}
  18. Ptr& ptr() const { return ptr_; }
  19. private:
  20. Ptr& ptr_;
  21. move_source(const Ptr&);
  22. };
  23. #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
  24. #pragma warning(pop)
  25. #endif
  26. } // End namespace move_ptrs.
  27. template<typename T>
  28. move_ptrs::move_source<T> move(T& x)
  29. { return move_ptrs::move_source<T>(x); }
  30. } // namespace 'ptr_container_detail'
  31. } // End namespace boost.
  32. #endif // #ifndef BOOST_MOVE_HPP_INCLUDED