summaryrefslogtreecommitdiff
path: root/mythfs/service/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'mythfs/service/util.h')
-rw-r--r--mythfs/service/util.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/mythfs/service/util.h b/mythfs/service/util.h
new file mode 100644
index 0000000..5e42b34
--- /dev/null
+++ b/mythfs/service/util.h
@@ -0,0 +1,31 @@
+#ifndef MYTHFS_UTIL_H
+#define MYTHFS_UTIL_H
+
+#include <vector>
+
+template <typename T, typename MT>
+std::vector<typename std::remove_const<MT>::type>
+operator/(const T & input, MT T::value_type::element_type::* m)
+{
+ std::vector<typename std::remove_const<MT>::type> result;
+ result.reserve(input.size());
+ for (const auto & i : input) {
+ result.push_back(i.get()->*m);
+ }
+ return result;
+}
+
+template <typename T, typename MT>
+std::vector<typename std::remove_const<MT>::type>
+operator/(const T & input, MT T::value_type::* m)
+{
+ std::vector<typename std::remove_const<MT>::type> result;
+ result.reserve(input.size());
+ for (const auto & i : input) {
+ result.push_back(i.*m);
+ }
+ return result;
+}
+
+#endif
+