|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-06-18 05:48:31
From: "Dirk Gerrits" <dirkg_at_[hidden]>
> Dirk Gerrits wrote:
> > Couldn't you do a compile-time 'select' on 'is_pointer' to redirect
> > pointer types to 'boost::detail::pointer_iterator_traits' and other
> > iterators to 'std::iterator_traits'? I haven't tried it, but in my mind
> > it seems plausible. Your thoughts?
>
> Oh but this should only be used where there is a lack of partial
> template specialization otherwise the users own specializations for
> iterator traits for pointers won't be used. Or is it illegal to make
> your own iterator_traits specializations in the first?
Actually, this is the perfect argument against doing what you're
suggesting. The only hope for users without partial specialization is to
explicitly specialize iterator_traits for their pointer iterator types, and
as you observe, dispatching to a different type would undermine that. And
no, specializing iterator_traits is not in general illegal, provided you
follow certain rules.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk