From: Rob Stewart (stewart_at_[hidden])
Date: 2004-04-02 15:33:19
From: David Abrahams <dave_at_[hidden]>
> Rob Stewart <stewart_at_[hidden]> writes:
> > From: David Abrahams <dave_at_[hidden]>
> >> Technically one can never say "class template foo is a traits
> >> template" or "class template foo is a policy" without examining how
> >> it's used. There's no fundamental reason that the same class template
> >> can't be used in both ways, so for any given class template, there may
> >> be no either/or answer.
> > I don't quite agree. A policy class is only that because it is a
> > template parameter.
> A class is never a template parameter. It can be a template argument.
Those two are often used interchangeably. The standard always,
may use "parameter" and "argument" in those senses, but they
aren't defined and common usage gets in the way. Anyway, I meant
"parameter" according to that dichotomy.
> > Whether a class that is passed as a policy
> > to some template happens to be a traits class is immaterial. So,
> > in the context of the template,
> Exactly. How it's used.
A traits class can be used as a policy. We're agreed. However,
that traits class is not a policy class. A class (template) can
be created to be a policy or it can be created to be a traits
class. In the former case, it is created specifically to meet a
need for a policy; there is no intention that code would ever be
written using its name directly. That is, it is only ever passed
as a template _argument_. By contrast, a traits class is not
created to be used as a policy. If a template comes along that
decides the traits class' interface is appropriate to be its
policy, then the traits class can be used as that templates
policy. That doesn't make the traits class a policy class, IMO.
Its use within the template is as a policy.
> > the template parameter is a policy class and that may correspond to
> > a traits class in a particular specialization, but that doesn't make
> > the traits class a policy class. Does that make sense?
> Not much, to me. I think you're trying to say the same thing I said,
> but in a more contorted way.
Therein lies the rub. You _think_ we're saying the same, but
neither of us is entirely sure yet.
BTW, once there's agreement, we need to try our hand at
-- 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