summaryrefslogtreecommitdiff
path: root/utils/logval.h
diff options
context:
space:
mode:
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>