This is part 13/14 of my Implementing IXmlWriter
post series.
As the private members of IXmlWriter
are getting too numerous and too likely to change by my judgment, today I will put last time’s IXmlWriter
behind a compilation firewall (pimpl).
The idea behind the pimpl idiom is to hide as much of the class definition as possible in order to avoid requiring users of the class to recompile if the class’s private members are changed. It is accomplished by moving all private members (functions, data, etc.) into a separate class (called the implementation or pimpl class) hidden from the class definition, and replacing these members with an opaque pointer to a forward declaration of this class. It works because a C++ compiler does not need to have the full definition of a class visible in order to allocate space for a pointer to the class; every pointer is a constant, fixed size (often 4 bytes).
Read more...