summaryrefslogtreecommitdiff
path: root/utils/logval.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-27 19:26:31 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-27 19:26:31 +0000
commit1eab70e16f0e0d5531f3babfea2062c82f6362e1 (patch)
treea1ea1930e585b9356c6e089465baa969bb6919bb /utils/logval.h
parent6ddaff1341e565dd91dca7ea763d0ea4d897f4c7 (diff)
compiles
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@626 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils/logval.h')
-rw-r--r--utils/logval.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/utils/logval.h b/utils/logval.h
index 4605d919..da0aa2b0 100644
--- a/utils/logval.h
+++ b/utils/logval.h
@@ -10,11 +10,18 @@
#include <limits>
#include <cassert>
#include "semiring.h"
+#include "show.h"
//TODO: template for supporting negation or not - most uses are for nonnegative "probs" only; probably some 10-20% speedup available
template <class T>
class LogVal {
public:
+ void print(std::ostream &o) const {
+ if (s_) o<<"(-)";
+ o<<v_;
+ }
+ PRINT_SELF(LogVal<T>)
+
typedef LogVal<T> Self;
LogVal() : s_(), v_(LOGVAL_LOG0) {}
@@ -143,6 +150,7 @@ class LogVal {
bool s_;
T v_;
+
};
template <class T>