movemove_sourcemove
The template function move allows the user to transfer owenership explicitly from one instance of static_move_ptr or dynamic_move_ptr to another in cases where implicit transfer of ownership is disallowed.
<boost/move_ptr/move.hpp>Note that it should never be necessary to include this header directly, since it is included by <boost/move_ptr.hpp>, <boost/move_ptr/static_move_ptr.hpp> and <boost/move_ptr/dynamic_move_ptr.hpp>.
namespace boost { namespace move_ptrs { template<typename Ptr> class move_source { public: move_source(Ptr& ptr); Ptr& ptr() const; }; } // End namespace move_ptrs template<typename Ptr> move_ptrs::move_source<Ptr> move(Ptr& x); } // End namespace boost
move_sourceThe class template move_source serves as the return type of move and as a constuctor argument to static_move_ptr and dynamic_move_ptr. It is simply a reference wrapper — boost::reference_wrapper could have been used instead. Its relation to static_move_ptr and dynamic_move_ptr is similar to the relation of std::auto_ptr_ref to std::auto_ptr, but move_source does not suffer from the same limitations.[1] The crucial differences are:
static_move_ptr or dynamic_move_ptr to move_source.
static_move_ptr and dynamic_move_ptr have templated constructors which take instances of move_source by value. There is no need for an additional user-defined conversion sequence.
| Ptr | - | A 'move pointer' type. Actually, most any type will do. |
move_source::move_sourcemove_source(Ptr& ptr);;
Constructs an instance of move_source which wraps the given instance of the template parameter Ptr.
move_source::ptr Ptr& ptr() const;
Returns a reference to the instance of the template parameter Ptr wrapped by this instance of move_source.
moveUsed to transfer ownership explcitly from one instance of static_move_ptr or dynamic_move_ptr to another.
| Ptr | - | A 'move pointer' type. Actually, most any type will do. |
boost::movetemplate<typename Ptr> move_ptrs::move_source<Ptr> move(Ptr& x);
Returns an instance of move_source which wraps the given instance of the template parameter Ptr.
[1]See, e.g., [Adamczyk1] and [Adamczyk2].
Revised 20 May, 2004
© Copyright Jonathan Turkanis, 2004
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Sha'arei Tefila, an Orthodox Shul (Synagogue) in Salt Lake City, Utah Chabad Lubavitch of Utah