Boost logo

Boost Users :

From: Tim Robertson (timr_at_[hidden])
Date: 2003-07-17 13:45:59


On Thu, 17 Jul 2003, David Abrahams wrote:

> Raoul Gough <yg-boost-users_at_[hidden]> writes:
>
> > David Abrahams <dave_at_[hidden]> writes:
> >
> >> Raoul Gough <yg-boost-users_at_[hidden]> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net