The C++ Pills are some little pieces of advice that take advantage of the
object-oriented support and the syntactic sugar in C++, or that (partially)
correct deficiencies in the C++ language.
C++ Pills:
- "Template-based policy-driven
by-value versus by-reference-to-const argument passing" describes a policy
that can be implemented by basic template techniques, to decide in one place
whether values of each type will be passed by value or by reference to const
for efficiency, with sensible
sizeof()-based defaults.
- "Hierarchy
introspection" describes how to have classes descended from a common ancestor
automatically declared to a repository during program initialisation, so that a
basic form of introspection (namely, having access to the constructors of all
the classes descended from a selected base class) can be achieved, and new
derived classes can be added to the code without modifying existing code
(either base or derived class code or user code).
- "Templated Pimpl
implementation" gives a small class that implements the "Pimpl" idiom using
templates.