|
Boost : |
Subject: Re: [boost] [concept] concept-based overloading (N2081)
From: David Abrahams (dave_at_[hidden])
Date: 2010-05-27 21:28:41
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.
-- Dave Abrahams Meet me at BoostCon: http://www.boostcon.com BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk