c++ - How to pass IloNumArray as an argument by reference -
i want pass ilonumarray
argument reference in function this:
void myfuntion(...., ilonumarray & x, ...) { // ... }
i know not correct. there other alternative?
it's considered 'wrong' pass iloxxx objects reference because handles pointing actual data, cost of passing iloxxx object same cost off passing reference. semantics of copying iloxxx objects passing reference, so
void myfunction(ilonumarray x) { x[0] = 1.0; } iloenv env; // create array 1 element, value of 0 ilonumarray x(env, 1, 0.0); myfunction(x); cout << x[0] << endl; // 1.0
Comments
Post a Comment