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

 

I see, and I do not understand. I hear, and I forget. I do, and I remember.

 
 --Proverb
 

The average man doesn’t want to be free. He wants to be safe.

 
 --Henry Louis Mencken

A constraint is a condition that one software element places on another, at compile time, in order for them to successfully interoperate. Constraints may be thought of as compile-time contract enforcements. I bang on at great length about constraints in Section 1.2 of Imperfect C++. My editor would be quite distraught if I were to repeat that material here, so I will just describe the two main types of constraints supported by the language and give a couple of examples of each.

Type System Leverage

The classic constraint given by Bjarne Stroustrup (in a ...

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