
On 16/06/10 02:08, er wrote:
You are right that csv is a new interface and it seems logical that it should be available for passing arguments by value.
I guess it wouldn't be an insurmountable task to overload csv() on the number of arguments, internally calling list_of(), and returning its results. That's approximately how ref_csv() and ref_list_of() relate to each other.
That sounds sensible. I think there should be such a function.
What is complicating things, however, is that list_of() itself is overloaded on the number of arguments. list_of<T>(x,y)(z,w) creates an anonymous list of elements created like this : T(x,y) and T(z,w).
If you want to achieve the same thing with cref_csv, you have to do: cref_csv(T(x,y),T(z,w))
I don't understand why that is a complication. In this case it would be logical for the user to use list_of instead (at least from the perspective of amount of typing). On a related subject (and perhaps slightly beyond the scope of a mini-review), have you considered a perfect forwarding version of any of these functions? Or even move-enabling the by-value ones? You're already justifying the _ref versions on grounds of speed; this would be the logical next step in that direction. Personally I would be happy to have such only in C++0x and not bother with move-emulation in C++03, but then I don't program in C++03 any more if I can possibly help it :). John Bytheway