summaryrefslogtreecommitdiff
path: root/decoder/logval.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-24 22:35:50 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-24 22:35:50 +0000
commit5d661b49dab6e0e3620efbd4e45a2ed53d04232c (patch)
tree9fd881a62c8211c5917834bb404047d4dc56fd08 /decoder/logval.h
parented704ce2e0ec5ebb64a07c68f977a830a8e7d161 (diff)
build on cygwin
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@23 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/logval.h')
-rw-r--r--decoder/logval.h29
1 files changed, 13 insertions, 16 deletions
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<T> 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<typename T>
-LogVal<T> operator+(const LogVal<T>& o1, const LogVal<T>& o2) {
- LogVal<T> res(o1);
- res += o2;
- return res;
+LogVal<T> operator+(LogVal<T> o1, const LogVal<T>& o2) {
+ o1 += o2;
+ return o1;
}
template<typename T>
-LogVal<T> operator*(const LogVal<T>& o1, const LogVal<T>& o2) {
- LogVal<T> res(o1);
- res *= o2;
- return res;
+LogVal<T> operator*(LogVal<T> o1, const LogVal<T>& o2) {
+ o1 *= o2;
+ return o1;
}
template<typename T>
-LogVal<T> operator/(const LogVal<T>& o1, const LogVal<T>& o2) {
- LogVal<T> res(o1);
- res /= o2;
- return res;
+LogVal<T> operator/(LogVal<T> o1, const LogVal<T>& o2) {
+ o1 /= o2;
+ return o1;
}
template<typename T>
-LogVal<T> operator-(const LogVal<T>& o1, const LogVal<T>& o2) {
- LogVal<T> res(o1);
- res -= o2;
- return res;
+LogVal<T> operator-(LogVal<T> o1, const LogVal<T>& o2) {
+ o1 -= o2;
+ return o1;
}
template<typename T>