diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-24 12:00:10 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-25 16:02:46 +0100 |
commit | 7301fe6484dc1b1d652425ad005ccfd214002a87 (patch) | |
tree | f12bf0ce0ed7adc3f0aea06cf85858aef8c1fdcb /src/util.hpp | |
parent | e30cbf9fef8922abef4cc44ad8628d4eef5d28a9 (diff) | |
download | webstat-7301fe6484dc1b1d652425ad005ccfd214002a87.tar.bz2 webstat-7301fe6484dc1b1d652425ad005ccfd214002a87.tar.xz webstat-7301fe6484dc1b1d652425ad005ccfd214002a87.zip |
Merge storeEntities into a single thing
Add visitSum for tuples and makes storeEntities into a single lambda.
Diffstat (limited to 'src/util.hpp')
-rw-r--r-- | src/util.hpp | 16 |
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); + } +} |