May 20th, 2008 — Enforcing Code Feature Requirements in C++ — Scott Meyers

Published: Thu 01 May 2008
By nwcpp

In 2008.


Building 41
One Microsoft Way
Redmond, Washington 98052


Functions often depend on particular behavioral characteristics (“features”) of code they invoke. For example, thread-safe code must invoke only thread-safe code if it is to remain thread-safe, and exception-safe code must invoke only exception-safe code. This talk describes a technique that enables the specification of arbitrary combinations of user-defined code features on a per-function basis and that detects violations of feature constraints during compilation. The technique applies to member functions (both nonvirtual and virtual), non-member functions, and function templates; operators are excluded.

(This is an updated version of the talk Scott gave in April 2007. Since then, he’s revised his approach to operate entirely during compilation and to support overloading on feature sets. He also no longer shows film clips during the presentation :-})


Scott Meyers is one of the world’s foremost authorities on C++; he provides training and consulting services to clients worldwide. He wrote the best-selling Effective C++ series (Effective C++, More Effective C++, and Effective STL); wrote and designed the innovative Effective C++ CD; is consulting editor for Addison Wesley’s Effective Software Development Series; was a founding member of the Advisory Board for The C++ Source. He has a Ph.D in Computer Science from Brown University. His web site is


Download the slides from the presentation.

Watch the video of the presentation.