summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2014-03-18 01:55:19 -0400
committerChris Dyer <redpony@gmail.com>2014-03-18 01:55:19 -0400
commit766629370bbecfb05513aed9cd16f783be5e1543 (patch)
treedb5b9958effef617706305b20e1c39c52931bd10 /utils
parent8e60188039211c9a585625dd8309f2ba57b0cbb2 (diff)
star bool
Diffstat (limited to 'utils')
-rw-r--r--utils/star.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils/star.h b/utils/star.h
index 3295112c..e7358ffa 100644
--- a/utils/star.h
+++ b/utils/star.h
@@ -1,6 +1,8 @@
#ifndef _STAR_H_
#define _STAR_H_
+// star(x) computes the infinite sum x^0 + x^1 + x^2 + ...
+
template <typename T>
T star(const T& x) {
if (!x) return T();
@@ -9,4 +11,8 @@ T star(const T& x) {
return T(1) / (T(1) - x);
}
+bool star(bool x) {
+ return x;
+}
+
#endif