Boost logo

Boost Users :

Subject: Re: [Boost-users] [fusion] for_each with indices
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2012-08-01 15:40:13


On 30/07/2012 10:23 p.m., Christopher Schmidt wrote:
> Agustín K-ballo Bergé <kaballo86_at_[hidden]> writes:
>> However, I would like to get the index as a compile time value. What
>> would be the simpler/best way to do this? Creating an iterator adaptor
>> that keeps track of advances to the base iterator (should I be using
>> the iterator_facade extension mechanism)? Or perhaps zipping the
>> sequence with some kind of infinite mpl::vector_c sequence?
>
> I would use fusion::fold with the index stored as state via a
> mpl::int_.
>

Simple enough! I hadn't considered the possibility of changing the State
type from invocation to invocation. Thank you.

Agustín K-ballo Bergé.-
http://fusionfenix.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