Boost logo

Boost :

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


From: "David B. Held" <dheld_at_[hidden]>
> "Gennadiy Rozental" <gennadiy.rozental_at_[hidden]> wrote in message
> news:c4ivdk$hgl$1_at_sea.gmane.org...
> > [...]
> > Trait is specific to the type
> > Policy is orthogonal to the type.
> > [...]
>
> Where "the type", I presume, is the [template] class using the
> policy | trait? That sounds like a good distinction to me. May I

No, it is the type for which you need the information or
behavior. So, in the case of std::basic_string<T>, "the type" is
not std::basic_string<T>, but rather T. (Perhaps that's what you
meant, but it isn't what I read.)

> formalize it by proposing that:
>
> 1. A trait is a metafunction of the client type.
>
> 2. A client type is a metafunction of a policy.
>
> So definition 1 means that a trait is a metafunction which maps a
> client type X to a specific trait type trait<X>. Definition 2 means
> that a policy client X is a metafunction which maps the client type
> to X<policy>. This makes it clear why a policy *class* need not be
> a template class. It also shows why a traits *client* need not be a
> template class. But I would welcome examples of non-template
> traits classes or non-template policy clients.

That's an interesting way to describe them and I think it fits my
model well.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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