|
Boost Users : |
From: Stuart Dootson (stuart.dootson_at_[hidden])
Date: 2007-03-26 18:19:51
On 26/03/07, Christian Henning <chhenning_at_[hidden]> wrote:
> Hi there, is it somehow possible to access a sequence element at
> runtime? Just image you're reading some name value pairs from file and
> you would like them to assign them to a fusion sequences. This way I
> don't know they order the values are supplied. Is that possible?
>
>
> Christian
I'm not a Fusion expert...but looking at the documentation, I think
you'll find that operations on sequences are non-mutating - i.e. you
have to construct a new sequence from the old sequence, but inserting
a replacement value for the type specifier you've just found - for
example, if you've just found an A() and you're inserting a_value:
seq = seq_type(make_pair<A>(a_value), at<B>(seq));
similarly, altering the B value would be
seq = seq_type(at<A>(seq), make_pair<B>(b_value));
You'd obviously also need some sort of run-time dispatching to call
the appropriate seq updating function.
Stuart Dootson
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