Boost logo

Boost Users :

Subject: Re: [Boost-users] Copy MPL sequence at runtime?
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-03-18 04:12:12


Rhys Ulerich wrote:

> Evening all,
>
> I'd like to copy the contents of a boost::mpl::vector_c (or similar)
> into an output iterator at runtime. I've not found a clean way to get
> an MPL sequence into a runtime-usable form. So far, I've gotten the
> included ugliness to work.
>
> 0) Is there some simple, idiomatic way to accomplish this goal that I've
> missed?
> 1) Any suggestions for how to clean this up? Specifically ways to
> reduce the assumptions about the underlying MPL sequence or fixes for
> braindead mistakes I've made?
> 2) Is there some way to have syntax like 'seqcopy<S>(iter)' where the
> iterator type is deduced but the sequence type is explicit?
>
> Thanks,
> Rhys
>

Good morning,

0) the "only" run-time stuff in the MPL is mpl::for_each.
1) See attached, I guess this could be considered a bit cleaner.
2) Probably easiest by writing a function that does the type deduction for
you.

But ... Perhaps Boost.Fusion is what you are looking for?

Hope this helps,
Cheers,

Rutger




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