Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2004-04-02 14:15:31

From: "Andy Little" <andy_at_[hidden]>
> 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.

I'd prefer unambiguous definitions or specifications, if you
please. ;-)

> 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
> traits mechanism.

I'm sure you meant the right thing, but you've stated what
parameterizes what backwards.

> (The traits mechanism associates an entity (usually a type) with a
> particular family of traits ).

I've always thought of it the other way around, but the effect is
the same. That is, I've always thought of it as associated the
set of traits with the entity.

> A policy customises (part of) an entity, usually by providing an
> (alternative) implementation of (some) functionality of the entity.

I don't agree with how you're characterizing this. A policy
provides the implementation -- informational, behavioral, or both
-- and, by substitution, can affect 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

Since you can't change it, it isn't a policy. You can either
take advantage of the functionality or not.

Rob Stewart                           stewart_at_[hidden]
Software Engineer           
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at, gregod at, cpdaniel at, john at