Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2004-10-09 21:28:37

>From: "Jaap Suter" <boost_at_[hidden]>

> what is the easiest way to convert an mpl::sequence to an std::sequence?
> I'm using such conversions a lot when unit-testing meta-code. I just wrote
> two versions of algorithms, a compile-time and the runtime one, and then
> compare their outputs.
> I recall hearing something about mpl::for_each having defined an operator
> for runtime purposes, but the details don't seem to be documented

Yeah, I guess Aleksey and Dave have been busy with the forthcoming MPL book,
but as I understand from list postings, the MPL docs will be updated in
Boost 1.32, and mpl::for_each is one of the more useful components. Since
it's not documented, I learned how it works from Aleksey. The following
works with your code:

template<class T>
struct to_sequence
  to_sequence(T &s) : sequence(s) {}

  template<class Element>
  void operator()(Element e)

  T &sequence;


// int_vector r_list = to_runtime<c_list>();

    int_vector r_list;




Boost list run by bdawes at, gregod at, cpdaniel at, john at