Boost logo

Boost :

Subject: Re: [boost] [concept] concept-based overloading (N2081)
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2010-05-28 10:49:05


On Thu, May 27, 2010 at 9:28 PM, David Abrahams <dave_at_[hidden]> wrote:
> At Thu, 27 May 2010 20:30:18 -0400,
> Lorenzo Caminiti wrote:
>>
>> On Thu, May 27, 2010 at 4:59 PM, Jeffrey Lee Hellrung, Jr.
>> <jhellrung_at_[hidden]> wrote:
>>
>> > And now that I've written this, I see this exact example is already
>> > elaborated on at the boost website:
>> >
>> > http://www.boost.org/community/generic_programming.html#tag_dispatching
>>
>> Great! The code from the Boost links above is _exactly_ what I was looking for.
>
> Actually that example is missing one crucial detail: inheritance of
> tags matching the refinement hierarchy.  The first few lines *should*
> read:
>
>  struct input_iterator_tag { };
>  struct bidirectional_iterator_tag : input_iterator_tag { };
>  struct random_access_iterator_tag : bidirectional_iterator_tag { };
>
> or, if you want to reflect the standard accurately,
>
>  struct input_iterator_tag { };
>  struct forward_iterator_tag : input_iterator_tag { };
>  struct bidirectional_iterator_tag : forward_iterator_tag { };
>  struct random_access_iterator_tag : bidirectional_iterator_tag { };
>
> That detail is what allows us to avoid writing a separate version of
> advance_dispatch for forward iterators.

I see. I have modified the Boost example to follow what STL does as
you indicated above. All seems to be working well. Thanks a lot.

-- 
Lorenzo

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