From: Andy Little (andy_at_[hidden])
Date: 2004-04-02 13:18:31
"David Abrahams" <dave_at_[hidden]> wrote in message
> "Gennadiy Rozental" <gennadiy.rozental_at_[hidden]> writes:
> >> A trait is a part of the definition of an entity.
> > That's right.
> Absolutely not. A key trait of traits is that they're non-intrusive.
> They create an association with that can be defined *after* the type
> argument is defined.
Surely a trait is *part of the *definition* * of an *entity* in a wider
(perhaps *definition* has wrong connotations)
A type declaration may be *one part * of a larger *entity* including it and
(for example) its operations, traits are parts of the wider entity too.
traits mechanism is one mechanism for associating parts of the wider
entity. (Another is function params via ADL etc)
But the root of the problem/thread is exactly what is a trait , or traits
and what is a policy. ie to try to come up with an ambiguous specification
of the word trait ,traits and policy in a C++ context.
A trait for an entity is used to describe a feature of the entity, usually
by parameterising the entity or some type involved in the entity via a
(The traits mechanism associates an entity (usually a type) with a
particular family of traits ).
A policy customises (part of) an entity, usually by providing an
(alternative) implementation of (some) functionality of the entity.
non UDT examples:
sizeof // has characteristics of a trait. Useful but cant change it
atexit // has characteristics of a policy. Usually has a default
functionality but can customise it
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk