--- hugin-2013.0.0.old/src/tools/ParseExp.cpp 2013-10-27 10:19:02.000000000 +0100 +++ hugin-2013.0.0/src/tools/ParseExp.cpp 2014-09-12 01:41:15.468973470 +0200 @@ -50,37 +50,45 @@ //power function struct lazy_pow_ { - template - struct result { typedef X type; }; + template struct result; + + template + struct result { typedef X& type; }; template - X operator()(X x, Y y) const + X& operator()(X& x, Y y) const { - return std::pow(x, y); + x= std::pow(x, y); + return x; } }; // modulus for double values struct lazy_mod_ { - template - struct result { typedef X type; }; + template struct result; + + template + struct result { typedef X& type; }; template - X operator()(X x, Y y) const + X& operator()(X& x, Y y) const { - return std::fmod(x,y); + x= std::fmod(x,y); + return x; } }; // if statement struct lazy_if_ { - template - struct result { typedef Y type; }; + template struct result; - template - X operator()(X x, Y y, Z z) const + template + struct result { typedef Y& type; }; + + template + Y& operator()(X x, Y& y, Y& z) const { return x ? y : z; } @@ -89,13 +97,16 @@ // wrapper for unary function struct lazy_ufunc_ { - template - struct result { typedef A1 type; }; + template struct result; + + template + struct result { typedef A1& type; }; template - A1 operator()(F f, A1 a1) const + A1& operator()(F f, A1& a1) const { - return f(a1); + a1= f(a1); + return a1; } };