C++ PATTERNS
Construct Variadic, Flexible and Scalable Interface for C++ Container
Packing and perfect forwarding for variadic arguments
Welcome to the third issue of practical C++ solutions. Previous two articles (the first and the second) were dedicated to container development. Well, we won’t stop and will continue to work with them. Though there are more things to talk about, for example, about interfaces and encapsulation. So, let’s unite these great topics.
Yes, people have been discussing one of the OOP pillars for a long time. And I won’t repeat all of those talks, as I believe you are already familiar with encapsulation. Instead, I want to focus on practical designs and applications. In our case, it is engineering the container’s interface.
Let’s imagine a simple container for complex values storage. It should provide preprocessing of the new element and create the content based on the additional arguments. For example: