I have a numerical Vector class, which is a wrapper on a float array, and I am sick of element-by-element initialization:
Vector vec(3);
vec(1) = 1;
vec(2) = 2;
vec(3) = 3;
Without using C++11 (Boost ok, but not preferable), what operators and tricks can I play to do this all at once, something resembling a brace-enclosed initializer list like:
Vector vec(3) = {1,2,3};
// --OR--
Vector vec(3) << 1 << 2 << 3;
or anything sane really.