Boost logo

Boost Users :

Subject: Re: [Boost-users] Please help with metaprogramming question : termination of recursion
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-07-08 20:54:25


> > You need to decide what function to call based on the _type_ of the
> > fusion iterators:
> > process_append(collection, begin, end, is_same<FusB, FusE>());
>
> There is no guarantee that the types will be the same _only_ when it is
> the end. I'm pretty sure that's the case on a straightforward
> implementation of 'cons', but what if the iterators are the same type when
> the dereferenced element is the same type? At the very least, guarantee a
> unique type for what 'end' is.
>
> Now if 'end' is a specific ending type, then I would hope to not need a
> metafunction to figure it out, but could use some "cons end-of-iteration
> type" easily obtainable from the cons, as an argument type of 'begin' in
> an overloaded form of the function. That is, tag "end" types with a base
> class for that purpose!
>
> Thanks for the fast reply! I thought I'd have to come back to it
> tomorrow.

Fusion iterators are unique regardless of the type of the value they
dereference to. If you look at how the Fusion algorithms are implemented
you'll see that there the same trick is utilized.

Regards Hartmut

---------------
Meet me at BoostCon
www.boostcon.com


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