shared_objunique_objSmart references, like Smart Interface Pointers, are class templates parameterized by an interface whose instances are capable of managing any object whose type implements the interface. They differ from smart pointers in two ways
operator* or operator->, and
get, reset and release, are implemented as non-member function to avoid clashing with member functions of the interface.
Boost.Interfaces includes two smart reference templates: unique_obj and shared_obj.
shared_obj
The class template shared_obj is a reference-counted smart reference template patterned on the template boost::shared_ptr.
unique_obj
The class template unique_obj is a smart reference template patterned on the template move_ptr introduced in [Hinnant1] as a safe replacement for std::auto_ptr. It has the following characteristics:
unique_obj type at any given time.
unique_obj may be passed to and returned from functions, transfering ownership from the caller to the function in the first case, and from the function to the caller in the second.
unique_obj may neither be assigned to nor be used to initialize a second instance of a specialization of the template.
Ownership may be transfered from an lvalue of type unique_obj using the function template move.
Revised 13 Jan, 2005
© Copyright Jonathan Turkanis, 2005. 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