Boost logo

Boost :

From: Stjepan Rajko (stipe_at_[hidden])
Date: 2007-06-25 18:50:47


Ping... anyone?

On 6/9/07, Stjepan Rajko <stipe_at_[hidden]> wrote:
> Hello,
>
> I've started to use fusion for the signal network gsoc project, and am
> really amazed with how much it simplified the prototype code (it
> brought down the need for preprocessing+file iteration to a bare
> minimum). Thanks for such a great library!
>
> I recently ran into a problem, though, and am wondering if someone
> could help me out. I have a need to do something along the lines of
> the following:
>
> boost::fusion::vector<int> a;
> boost::fusion::vector<int &> b(a); // first element of b refers to the
> first element of a
>
> Using fusion from CVS HEAD, this doesn't work because all of the
> related constructors take a const & argument. A similar use case (but
> not exactly what I need) does work:
>
> boost::fusion::vector<int> a;
> boost::fusion::vector<const int &> b(a);
>
> as does this: (but i'd like to avoid this approach because in my exact
> case the size of the vectors varies)
>
> boost::fusion::vector<int> a;
> boost::fusion::vector<int &> b(boost::fusion::at_c<0>(a));
>
>
> I tried adding non-const versions of the constructors / helper
> functions to vector/vector.hpp and vector/vector_n.hpp, and after
> doing so the use case I need works OK.
>
> Unless there is an alternative way of doing what I'm trying to do,
> would it be possible to add in the non-const versions of the
> constructors? I don't mind producing the patches if someone points me
> to all the places where the non-const constructors should be added to
> make the addition consistent, as well as to any non-obvious things
> that would also need to be done (keeping in mind that currently my
> scope of "obvious" appears to be pretty limited :-))
>
> Thanks for your help,
>
> Stjepan
>


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