On Thu, 17 Jul 2003, David Abrahams wrote:
Raoul Gough
writes: David Abrahams
writes: Raoul Gough
writes: [snip] Really seems a bit weird that boost::referent wasn't already invented in the type_traits portion of the library, since it can be applied to any kind of pointer, iterator, etc... Anyway, it has neatened up my code quite a bit, thanks.
It's a little quirky, yet. If you define an iterator with a nested element_type member it will do the wrong thing.
I guess in an ideal world, we would have something like this:
template<typename T> struct handle_traits { typedef typename T::value_type value_type; typedef typename T::pointer_type pointer_type; typedef typename T::reference_type reference_type; };
template<typename T> struct iterator_traits : public handle_traits<T> { typedef typename T::iterator_category iterator_category; typedef typename T::difference_type difference_type; };
I don't see why that's preferable to what we have now with referent.
As an outsider to your development process, the above is a lot easier to understand. The problem you're trying to fix is (mostly) clear at first glance. A "referent," on the other hand, is an underused wording/concept, and IMO, harder to comprehend. -tim