Function Template move

Description
Headers
Reference
Synopsis
Class Template move_source
Function Template move

Description

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.

Headers

<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>.

Reference

Synopsis

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

Class Template move_source

Description

The 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:

Template parameters

Ptr- A 'move pointer' type. Actually, most any type will do.

move_source::move_source

    move_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.

Function Template move

Description

Used to transfer ownership explcitly from one instance of static_move_ptr or dynamic_move_ptr to another.

Template parameters

Ptr- A 'move pointer' type. Actually, most any type will do.

boost::move

template<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].


Sha'arei Tefila, an Orthodox Shul (Synagogue) in Salt Lake City, Utah Chabad Lubavitch of Utah