Boost logo

Boost :

From: Mat Marcus (mmarcus_at_[hidden])
Date: 2000-10-02 12:59:25


>Looks like ISPTR used as a discriminator for full class
>specialization
>will work if ISCONST used as a secondary discriminator and member
>template classes work :
>
>template <bool is_ptr, bool is_const>
>struct iterator_traits_helper
>{
> template <class Iterator> class iterator_traits_base {
> typedef typename Iterator::value_type value_type;
> ...
> }
>};
>
>template<>
>struct iterator_traits_helper<true, true>
>{
> // we know for sure this guy is const T*
> // remove_const template is supposed to remove const -- do we have
>that ???
> template <class Iterator> class iterator_traits_base {
> typedef typename remove_const<Iterator>::value_type value_type;
> ...
> }
>};
>
>template <class T>
>struct iterator_traits : public
>iterator_traits_helper::iterator_traits_base<IS_PTR<T>::Ret,
>IS_CONST<T> > {
>};
>
>The problem might be that VC6 might not work very well with typedefs
>inside member template classes...

It looks like you have rediscovered the metactrl::IF technique.
However the problem of determining the underlying type from a pointer
template parameter at compile time remains unsolved AFAIK.

- Mat


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