
Hi Max & Ravi Ravi wrote:
On Saturday 03 May 2008 09:12:01 pm Max wrote:
double d0, d1, d2, d3; boost::array
array = {{d0, d1, d2, d3}}; for(int i=0; i<4; i++) array[i] = i; assert(d2 == 2); [snip]
If it won't take a long time, is it possible to rewrite the above code snnipet making use of boost.Ref?
#include
#include #include <cassert>
int main() { typedef boost::reference_wrapper<double> double_ref_t; boost::array
array; double_ref_t d0( array[0] ); double_ref_t d1( array[1] );
array[0] = 1.0; array[1] = 2.0; assert( d1 == 2.0 );
d0 += d1; assert( d0 == 3.0 ); }
or even:
#include <cassert>
#include