Chapter 10. Duck and Goose, or the Whimsical Bases of Partial Structural Conformance


Sometimes it kind of bothers me that our brains are so good at optimizing themselves for the task at hand. They get really good at discarding knowledge that is no longer necessary.

 --Sean Kelly

It’s harder to read code than to write it.

 --Joel Spolsky


Named Conformance

Classically (by which I mean before template generics), types were verified to have the appropriate requirements for an operation by having the same name as the types that the operation requires. This is known as Named Conformance. Although it seems blatantly obvious, the insight comes when we consider the effect of inheritance. As we all know from those $2,000-a-day courses on object ...

Get Extended STL, Volume 1: Collections and Iterators now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.