summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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