Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Class postconstructor_invoker

boost::signals2::postconstructor_invoker — Pass arguments to and run postconstructors for objects created with deconstruct().

Synopsis

// In header: <boost/signals2/deconstruct.hpp>


class postconstructor_invoker {
public:

  // public methods
  operator const shared_ptr<T> &();
  const shared_ptr<T> & postconstruct();
  template<typename A1> const shared_ptr<T> & postconstruct(A1);
  template<typename A1, typename A2> 
    const shared_ptr<T> & postconstruct(A1, A1);
  template<typename A1, typename A2, ..., typename AN> 
    const shared_ptr<T> & postconstruct(A1, A1, ..., A1);
};

Description

Objects of type postconstructor_invoker are returned by calls to the deconstruct() factory function. These objects are intended to either be immediately assigned to a shared_ptr (in which case the class' conversion operator will perform the conversion by calling the postconstruct with no arguments), or to be converted to shared_ptr explicitly by the user calling one of the postconstruct methods.

postconstructor_invoker public methods

  1. operator const shared_ptr<T> &();

    The conversion operator has the same effect as explicitly calling the postconstruct method with no arguments.

  2. const shared_ptr<T> & postconstruct();
    template<typename A1> const shared_ptr<T> & postconstruct(A1 a1);
    template<typename A1, typename A2> 
      const shared_ptr<T> & postconstruct(A1 a1, A1 a2);
    template<typename A1, typename A2, ..., typename AN> 
      const shared_ptr<T> & postconstruct(A1 a1, A1 a2, ..., A1 aN);

    The postconstruct methods make an unqualified call to adl_postconstruct() and then return the shared_ptr which was wrapped inside the postconstructor_invoker object by deconstruct(). The first two arguments passed to the adl_postconstruct() call are always the shared_ptr owning the object created by deconstruct(), followed by a ordinary pointer to the same object. As a convenience, the ordinary pointer will always be cast to point to a non-const type before being passed to adl_postconstruct. The remaining arguments passed to adl_postconstruct are whatever arguments the user may have passed to the postconstruct method.


PrevUpHomeNext