summaryrefslogtreecommitdiff
path: root/src/util.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.hpp')
-rw-r--r--src/util.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util.hpp b/src/util.hpp
new file mode 100644
index 0000000..0ed260c
--- /dev/null
+++ b/src/util.hpp
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <tuple>
+
+namespace WebStat {
+ template<typename... T>
+ auto
+ visitSum(auto && visitor, const std::tuple<T...> & values)
+ {
+ return std::apply(
+ [&](auto &&... value) {
+ return (visitor(value) + ...);
+ },
+ values);
+ }
+}