Link to home
Start Free TrialLog in
Avatar of lavitz
lavitzFlag for Poland

asked on

What pattern is this

Hi,

I saw that in boost::asio.
Maybe someone knows name of this pattern and why/when should i use it or why not.
Its remainds me pimpl idiom.
Pattern looks like this

 
template <typename ServiceName>
class basic_service
{
  typedef ServiceName ImplType
public:
     Init()
     {
        impl_.Init();
     }
private:
    ImplType impl_
};

From what i see. I could pass different types in template argument: 
basic_service<Service1> aaa
basic_service<Service2> bbb

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of XMarshall10
XMarshall10

I agree that this is an pimpl pattern.

The code: ImplType impl_
  is a forward declaration of an opaque pointer, details of which is implemented in the implementation file (generally the corresponding CPP file).

In C++ jargon, this is also known as Compiler firewall.

-XM