summaryrefslogtreecommitdiff
path: root/utils/star.h
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
commit55beb71dbbfe8421a8e8be9d2d7868a5d87d77d5 (patch)
tree12783e176d61567f8c18a162a1d2d863638385db /utils/star.h
parent606e3e38b8a830dbbe65963ebf6c5ce7866b7800 (diff)
star bool
Diffstat (limited to 'utils/star.h')
-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