| 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 | |
| 5 | // Contains the definitions of the class template move_source and the function |
| 6 | // template move, which together make move pointers moveable. |
| 7 | |
| 8 | #ifndef BOOST_MOVE_HPP_INCLUDED |
| 9 | #define BOOST_MOVE_HPP_INCLUDED |
| 10 | |
| 11 | namespace boost { namespace ptr_container_detail { |
| 12 | |
| 13 | namespace move_ptrs { |
| 14 | |
| 15 | #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) |
| 16 | #pragma warning(push) |
| 17 | #pragma warning(disable:4512) |
| 18 | #endif |
| 19 | |
| 20 | template<typename Ptr> |
| 21 | class move_source { |
| 22 | public: |
| 23 | move_source(Ptr& ptr) : ptr_(ptr) {} |
| 24 | Ptr& ptr() const { return ptr_; } |
| 25 | private: |
| 26 | Ptr& ptr_; |
| 27 | move_source(const Ptr&); |
| 28 | }; |
| 29 | |
| 30 | #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) |
| 31 | #pragma warning(pop) |
| 32 | #endif |
| 33 | |
| 34 | } // End namespace move_ptrs. |
| 35 | |
| 36 | |
| 37 | template<typename T> |
| 38 | move_ptrs::move_source<T> move(T& x) |
| 39 | { return move_ptrs::move_source<T>(x); } |
| 40 | |
| 41 | } // namespace 'ptr_container_detail' |
| 42 | } // End namespace boost. |
| 43 | |
| 44 | #endif // #ifndef BOOST_MOVE_HPP_INCLUDED |
| 45 | |