Traits: The else-if-then of Types, by Andrei Alexandrescu - 3 views
-
Definition: A traits template is a template class, possibly explicitly specialized, that provides a uniform symbolic interface over a coherent set of design choices that vary from one type to another.
-
An important use of traits is as "interface glue"—universal non-intrusive adapters. If various classes implement a given concept in slightly different ways, traits can fit those implementations to a common interface.
-
Definition: A traits class (as opposed to a traits template) is either an instantiation of a traits template, or a separate class that exposes the same interface as a traits template instantiation.
- ...3 more annotations...