
On 6/26/07, Stjepan Rajko <stipe@asu.edu> wrote:
On 6/26/07, dan marsden <danmarsden@yahoo.co.uk> wrote:
Does the attached code, using transform_view do what you need? I'm not comfortable adding non const ctors to vector for a few reasons, so I'd prefer this approach if possible.
This works great, thanks! I did try a transform_view approach after I
Found a case where it doesn't compile - adapting your example to how I'm using it: typedef fusion::vector<int, int> vec; vec v(1,2); fusion::transform_view<vec, make_ref> t(v, make_ref()); fusion::vector<int &, int &> vec_of_references(t); // this works fine, exactly what I need However, if I change this to: typedef fusion::vector<> vec; vec v; fusion::transform_view<vec, make_ref> t(v, make_ref()); fusion::vector<> vec_of_references(t); // does not compile The problem is that since vec_of_references is a vector of size 0 then it can't initialize from the transform_view because vector0 has no constructors defined (so only copy constructible). For sake of consistency, would it be possible to add a templated constructor to vector0 that could take a fusion sequence and do nothing with it? I'm using this from a templated class and it would be helpful if I didn't have to specially treat the size 0 case. Or, perhaps there is another simple solution I'm missing... :-) Thanks! Stjepan