PrevUpHomeNext

Applications

Delegating Constructors
Lazy-Instantiation Optimization
Singleton
Extendible Unique-Entry Collection
Non-Extendible Unique-Entry Collection
Internal (Implementation-Only) Run-Time Polymorphism
Run-Time Polymorphic Class Hierarchy

The delegating constructors functionality is available in C++11. For implementation reasons that functionality might be implemented using Pimpl:

struct Foo : boost::impl_ptr<Foo>::shared
{
   Foo ();
   Foo (int);
};

Foo::Foo(int v) : impl_ptr_type(in_place, v) { ... };

Foo::Foo() : impl_ptr_type(nullptr) // Delegating constructor
{
  *this = Foo(42); // Calling the actual constructor
};

PrevUpHomeNext