
10 Feb
2012
10 Feb
'12
1:46 a.m.
Is there any facility to perform arithmetic operations on a tuple? For example: struct data { double a, b; }; data d1 = {1.0, 2.0}; data d2 = {2.5, 5.5}; // These two lines are not valid, but simulate what I want. boost::tie(d1.a, d1.b) *= 10.0; // Multiply each element by 10.0 boost::tie(d1.a, d1.b) += boost::tie(d2.a, d2.b); // Add the elements from the second object After calculations, d1 should equal {12.5, 25.5}; Thanks, -- Bill