summaryrefslogtreecommitdiff
path: root/src/utils/TorchUtils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/TorchUtils.h')
-rw-r--r--src/utils/TorchUtils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils/TorchUtils.h b/src/utils/TorchUtils.h
index 8b7a3f1..275ec47 100644
--- a/src/utils/TorchUtils.h
+++ b/src/utils/TorchUtils.h
@@ -24,6 +24,15 @@ std::string to_hex(T number, const bool append0x = true) {
return format;
}
+template <typename Container, typename Key>
+constexpr bool contains(const Container& c, const Key& k) {
+#if __cplusplus >= 202002L
+ return c.contains(k);
+#else
+ return c.find(k) != c.end();
+#endif
+}
+
uint32_t translate(uint32_t offset);
std::vector<std::filesystem::directory_entry> getRecursiveEntries(const std::filesystem::path baseDir);