From 98842dca74bc8743b8ce178037403823a07b620e Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Fri, 8 Feb 2013 00:56:42 +0000 Subject: [PATCH] Trivial --- packages/CLPBN/horus/CountingBp.h | 18 ++++++------------ packages/CLPBN/horus/LiftedUtils.h | 6 ++---- packages/CLPBN/horus/Util.h | 27 +++++++++------------------ 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/packages/CLPBN/horus/CountingBp.h b/packages/CLPBN/horus/CountingBp.h index 77a6c64e3..cdfeea824 100644 --- a/packages/CLPBN/horus/CountingBp.h +++ b/packages/CLPBN/horus/CountingBp.h @@ -43,18 +43,13 @@ inline size_t hash_combine (size_t seed, const T& v) namespace std { -template struct hash> -{ - size_t operator() (const std::pair& p) const - { +template struct hash> { + size_t operator() (const std::pair& p) const { return horus::hash_combine (std::hash()(p.first), p.second); - } -}; +}}; -template struct hash> -{ - size_t operator() (const std::vector& vec) const - { +template struct hash> { + size_t operator() (const std::vector& vec) const { size_t h = 0; typename std::vector::const_iterator first = vec.begin(); typename std::vector::const_iterator last = vec.end(); @@ -62,8 +57,7 @@ template struct hash> h = horus::hash_combine (h, *first); } return h; - } -}; +}}; } // namespace std diff --git a/packages/CLPBN/horus/LiftedUtils.h b/packages/CLPBN/horus/LiftedUtils.h index fe1eba80e..75c05c635 100644 --- a/packages/CLPBN/horus/LiftedUtils.h +++ b/packages/CLPBN/horus/LiftedUtils.h @@ -77,14 +77,12 @@ namespace std { template <> struct hash { size_t operator() (const horus::Symbol& s) const { return std::hash() (s); - } -}; +}}; template <> struct hash { size_t operator() (const horus::LogVar& X) const { return std::hash() (X); - } -}; +}}; } // namespace std diff --git a/packages/CLPBN/horus/Util.h b/packages/CLPBN/horus/Util.h index 480ef87bb..a5972a9f5 100644 --- a/packages/CLPBN/horus/Util.h +++ b/packages/CLPBN/horus/Util.h @@ -402,35 +402,26 @@ operator<< (std::ostream& os, const std::vector& v) namespace func_obj { template -struct max : public std::binary_function -{ - T operator() (const T& x, const T& y) const - { +struct max : public std::binary_function { + T operator() (const T& x, const T& y) const { return x < y ? y : x; - } -}; +}}; template -struct abs_diff : public std::binary_function -{ - T operator() (const T& x, const T& y) const - { +struct abs_diff : public std::binary_function { + T operator() (const T& x, const T& y) const { return std::abs (x - y); - } -}; +}}; template -struct abs_diff_exp : public std::binary_function -{ - T operator() (const T& x, const T& y) const - { +struct abs_diff_exp : public std::binary_function { + T operator() (const T& x, const T& y) const { return std::abs (std::exp (x) - std::exp (y)); - } -}; +}}; } // namespace func_obj