From the Modern Maintainable Code blog:
Two fundamental implementations for one conceptual object
by Mark Isaacson
From the article:
This is the third article of a series on code reuse. This article discusses how to select between implementations of an object based on patterns in type information. The article uses std::unique_ptr's deleter as a practical case study.
You can find the previous article of the series here (which discusses the analogous problem as it pertains to functions), and the prelude to the next article, which looks at the same problem with one caveat: designing it so that some, but not all, of the methods will be implemented the same way no matter what types you instantiate the object with, here.
Add a Comment
Comments are closed.