Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-02 08:48:01


----- Original Message -----
From: <yahoo_at_[hidden]>
> Well, I was just advocating for consistency in the way of passing
> iterator infos (traits) as template parameters. I see that policy
> classes use Traits template argument and code like this does not:

<example code snipped>

> I realize that policy is used after the iterator is built so
> std::iterator_traits<> is available, but why not always pass traits
> the same way, as one class.

I'm sorry, I just don't see where traits are passed "as one class" (or any
other way, for that matter) as a type parameter to a policies template. In
point of fact, the example policies classes are themselves /not/ templates
in order that they may be easily used with and orthogonal to the iterator
type.

> I also realize that the Standard does express type infos is strustured
> ways (traits) as often as I'd like to. But am I the only one to get
> tired of endlessly typing "typedef typename XXX::yy yy;"
> (At least it will kick me to learn emacs enough to automate it :-) )

I get tired of it, too... but I don't see how your proposal would reduce the
frequency with which you have to do it.

> > Why not just use:
> is_sensible<std::iterator_traits<iterator_adaptor<...> >
> > >::ret
> > ??
>
> Well, I think you answered it all, if is_sensible<> takes a Traits
> parameter to express some iterator type properties, so should
> iterator_adaptor<> for consistency reasons in my opinion.

Uhm, is_sensible doesn't exist yet, so there's no precedent. If /I/ were
designing it, it would take an iterator type, not traits ;-)

> Even if std::iterator_traits<> is not available.
> (boost::iterator_traits_helper< sensible defaults> could be)

> Please, do not take this as a rant from some lazy guy who did not
> unsertand / bother to note that he was using an pre-release library
> and does not want to rewrite code!
> I will rewrite it anyway when View template Libray is available ;-)

I don't take it that way. I am arguing with you in hopes of getting clarity,
because I am hoping that when I understand your remarks they will be useful.

> Thanks again for your excellent work in Boost and iterator_adaptor
> especially !

My pleasure.

-Dave


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