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 14. Henney’s Hypothesis, or When Templates Attack!

 

Inconsistency imposes mental friction into a developer’s work.

 
 --Scott Meyers

Writing good template libraries in C++ is a delicate balance between exercising the considerable power afforded by template programming and making overly complex and undiscoverable interfaces that confound users. Kevlin Henney has suggested a relationship that captures the essence of this balance, which I call Henney’s Hypothesis.

Henney’s Hypothesis

For each additional [required] template parameter, the potential number of users is halved.

The “[required]” part is my own humble addition to the hypothesis. I think this is an important modification since it’s the number of template parameters a user is required ...

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