Boost logo

Boost :

Subject: [boost] [fusion] for_each
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2010-10-06 03:53:07

I think it's at least partly my mistake. It took me some time to
manage a limited example not compiling:

#include <boost/fusion/container/set.hpp>
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/include/at_key.hpp>
#include <boost/fusion/include/for_each.hpp>
#include <boost/fusion/include/as_vector.hpp>

struct A
  int adata;
struct B
  int bdata;
struct C
  int cdata;

typedef boost::fusion::set<A, B, C> my_set_type;
typedef boost::fusion::vector<A, B> my_vector_type;

struct update
         update(my_set_type& to_overwrite_):to_overwrite(to_overwrite_){}
         template<typename T>
         void operator()(T& elt) const
         my_set_type& to_overwrite;

int main()
  my_set_type my_set;
  my_vector_type my_vec;


Now it will compile if you replace boost::fusion::as_vector(my_vec) by
my_vec or T& by T const&.
Ok so it seems my problem description is wrong and I needed to know
that as_vector returns a const vector, right?


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