Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-06-14 00:52:40


jsiek_at_[hidden] writes:
> The custom tag issue will be more difficult... as of right now I don't
> see a way to handle that. The problem is that class template
> specialization requires exact matches. Therefore if you have a
> sub-class of std::random_access_iterator_tag, you'll get the default
> unspecialized iterator_adaptor instead of the specialization for
> std::random_access_iterator_tag :( I'll need to put my thinking cap
> on...

I've got a possible solution for this... has a slight catch though.
It requires custom iterator tags to specialize an inheritance_traits
class. This allows me to traverse up the inheritance tree looking for
a match.

struct my_iterator_tag : public std::random_access_iterator_tag { };

namespace boost {
  template<> struct inheritance_traits<my_iterator_tag> {
    static const bool has_base_class = true;
    typedef std::random_access_iterator_tag base_class_type;
  };
}

Ciao,

Jeremy


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