Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2004-09-09 13:42:24


Arkadiy Vertleyb wrote:
> The problem is that you can't specialize (or overload) on a nested types.
> The Standard clearly says that this is a non-deducible context. So we can't
> do something like:
>
> template<class V, class T> encode_type<V, T::iterator>{}; // compiler error!
>
> This 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;
};

-- 
Alexander Nasonov

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