O'Reilly logo

Extended STL, Volume 1: Collections and Iterators by Matthew Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required