Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-09-09 14:51:05


"Alexander Nasonov" <alnsn_at_[hidden]> wrote in message

> Arkadiy Vertleyb wrote:
>
> > This [unability to specialize on standard iterators] is VERY
unfortunate,
> > and I 've been trying to think of workarounds, but
> > so far I only came up with one that is quite limited and ugly... So I
> > decided to put this on hold.
>
> Can enable_if help you?
>
> template<class V, class T, class Enabled = void>
> struct encode_type;
>
> template<class V, class T>
> struct encode_type<V, T, typename enable_if<has_iterator<T> >::type>
> {
> typedef typename T::iterator this_is_what_you_need;
> };

I think this is a specialization for a container that has an iterator rather
for the iterator itself. And any similar specialization for an _iterator_,
that I can think about, would not have information about the container type
:(

The workaround I was talking about was to extract the value_type from the
iterator, and using it bring the type into deducible context, but this only
works for the simplest container types (only parameterized with value_type).

Regards,
Arkadiy


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