From 5d661b49dab6e0e3620efbd4e45a2ed53d04232c Mon Sep 17 00:00:00 2001 From: graehl Date: Thu, 24 Jun 2010 22:35:50 +0000 Subject: build on cygwin git-svn-id: https://ws10smt.googlecode.com/svn/trunk@23 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/logval.h | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'decoder/logval.h') diff --git a/decoder/logval.h b/decoder/logval.h index 7099b9be..622b308e 100644 --- a/decoder/logval.h +++ b/decoder/logval.h @@ -79,32 +79,29 @@ class LogVal { T v_; }; +// copy elision - as opposed to explicit copy of LogVal const& o1, we should be able to construct Logval r=a+(b+c) as a single result in place in r. todo: return std::move(o1) - C++0x template -LogVal operator+(const LogVal& o1, const LogVal& o2) { - LogVal res(o1); - res += o2; - return res; +LogVal operator+(LogVal o1, const LogVal& o2) { + o1 += o2; + return o1; } template -LogVal operator*(const LogVal& o1, const LogVal& o2) { - LogVal res(o1); - res *= o2; - return res; +LogVal operator*(LogVal o1, const LogVal& o2) { + o1 *= o2; + return o1; } template -LogVal operator/(const LogVal& o1, const LogVal& o2) { - LogVal res(o1); - res /= o2; - return res; +LogVal operator/(LogVal o1, const LogVal& o2) { + o1 /= o2; + return o1; } template -LogVal operator-(const LogVal& o1, const LogVal& o2) { - LogVal res(o1); - res -= o2; - return res; +LogVal operator-(LogVal o1, const LogVal& o2) { + o1 -= o2; + return o1; } template -- cgit v1.2.3