
27 Sep
2007
27 Sep
'07
3:38 p.m.
Hi, It is mentioned at http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#performance that the following two ways would be different in term of performance. ////////////// void f1(int&, double&); tuple<int, double> f2(); //Then, the call #1 may be slightly faster than #2 in the code below: int i; double d; ... f1(i,d); // #1 tie(i,d) = f2(); // #2 /////////////////// What about the current commonly used compiler, such as GCC? Are #1 and #2 different in GCC? Does the compiler always have some way to optimize #2 to make it as good as #1? Is it just a matter of fact whether the optimization method is implemented? Or #2 can never be made as good as #1? Thanks, Peng