Chapter 13. Inferred Interface Adaptation: Compile-Time Adaptation of Interface-Incomplete Types
It is better to stay silent and be thought a fool, than to speak and remove all doubt. | ||
--Abraham Lincoln |
But we don’t need to know the Latin bit. Why is everyone always going back to Latin? It was ages ago. | ||
--Karl Pilkington |
Introduction
Adaptor class templates are used to convert a class, or a related group of classes, from an existing interface to a new interface. Consider the std::stack
class template, which is used to adapt sequence containers to an interface that exhibits the stack operations push()
and pop()
, as shown in Listing 13.1. This works because all the methods of std::stack
are implemented in terms of the public interface of the adapted ...
Get Extended STL, Volume 1: Collections and Iterators now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.