Function Template move

Description
Headers
Reference
Synopsis
Class Template move_source
Function Template move

Description

The function template move allows the user to transfer owenership explicitly from one instance of unique_ptr or unique_obj to another in cases where implicit transfer of ownership is disallowed.

Headers

<boost/interfaces/move.hpp>

It should never be necessary to include this header directly, since it is included by <boost/interfaces/unique_ptr.hpp> and <boost/interfaces/unique_obj.hpp>.

Reference

Synopsis

namespace boost { namespace interfaces {

template<typename Ptr>
class move_source {
public:
    move_source(Ptr& ptr);
    Ptr& ptr() const;
};

template<typename Ptr>
move_ptrs::move_source<Ptr> move(Ptr& x);

} } // End namespace boost::interfaces

Class Template move_source

Description

The class template move_source serves as the return type of move and as a constuctor argument to unique_ptr and unique_obj. It is simply a reference wrapper — boost::reference_wrapper could have been used instead.

Template Parameters
Ptr- A type having a 'move constuctor' — i.e., a constructor taking a const reference to move_source<Ptr>.

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

Used to transfer ownership explcitly from one instance of unique_ptr or unique_obj to another.

Template Parameters
Ptr- A type having a 'move constuctor' — i.e., a constructor taking a const reference to move_source<Ptr>.
template<typename Ptr>
interfaces::move_source<Ptr> move(Ptr& x);

Returns an instance of move_source which wraps the given instance of the template parameter Ptr.


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