
Hi, I need something like the following (somewhat contrived) example to work with boost::fusion::transform on a boost::fusion::vector<int&> or other vector types that have reference types. Note that the following doesn't compile. --------------------------- #include <boost/fusion/sequence/container/vector.hpp> #include <boost/fusion/algorithm/transformation/transform.hpp> struct pass_through { template <typename SignatureT> struct result; template <typename T> struct result<pass_through (T)> { typedef T type; }; template <typename T> T operator () (T value) const { return value; } }; int main() { using namespace boost::fusion; int i = 5; vector<int&> v(i); vector<int&> v2(transform(v, pass_through())); return 0; } --------------------------- This code doesn't compile because in deref_impl for the transform_view when this code static type call(Iterator const& i) { return i.f(*i.first); } calls the pass_through function object's operator (), the compiler deduces T to be int instead of int&. Is there any way to make this work with Boost.Fusion, e.g. by somehow additionally passing the actual type stored in the vector to the function object in some way instead of relying on the compiler to deduce it? I was thinking of maybe using the binary version of transform and passing in a range_c containing integral constants from 0 to <size of vector - 1> and then using this in operator () to retrieve the actual type from the vector by using mpl::at. Is there a better/simpler way? Thanks, Martin