Skip to main content

Home/ Coders/ Contents contributed and discussions participated by Fabien Cadet

Contents contributed and discussions participated by Fabien Cadet

Fabien Cadet

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...
  • traits with state
  • general-purpose traits
  • hierarchy-wide traits—traits that you can define in one shot not just for a class, but for a whole hierarchy or subhierarchy.
  •  
    "Traits: The else-if-then of Types"
« First ‹ Previous 101 - 120 of 338 Next › Last »
Showing 20 items per page