I'm currently trying to implement a class around a valarray object and i get a exception when trying to run:
class TestClass
{
public:
valarray<int> va;
TestClass() { va.resize(5, 1); }
slice_array<int>& get_slice()
{
return va[slice(0, 3, 2)];
}
};
//In main():
TestClass obj;
slice_array<int>& ref = obj.va[slice(0,3,2)];
ref = -1; //OK
obj.get_slice() = -1; //Throws exception
Aren't the two assignments the same thing?