Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-02-12 07:24:15


> I've checked in a preliminary generic programming techniques reference
page
> at more/generic_programming.html. You may want to place links into this
page
> in new boost documentation.

Additions:

Traits associate information with a compile-time entity. It can be a type,
an integral constant, or an address.

In "For an in-depth description of std::type_traits" 'std::type_traits'
should be std::iterator_traits.

A variation of the Traits idiom is what I call "dynamic traits," although
the established name is "External polymorphism." Dynamic traits effectively
associate a vtable with a compile-time entity, usually a type. Since it's
not possible (portably) to get to the vtable in C++, I usually store a
pointer to an empty singleton (contains only the vptr.)

The technique allows "adding" polymorphic behaviour to a non-polymorphic
type.

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk