summaryrefslogtreecommitdiff
path: root/src/utils/cpp/concepts.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/cpp/concepts.hpp')
-rw-r--r--src/utils/cpp/concepts.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/cpp/concepts.hpp b/src/utils/cpp/concepts.hpp
index 92718b43..597179e1 100644
--- a/src/utils/cpp/concepts.hpp
+++ b/src/utils/cpp/concepts.hpp
@@ -1,6 +1,7 @@
#ifndef INCLUDED_SRC_UTILS_CPP_CONCEPTS_HPP
#define INCLUDED_SRC_UTILS_CPP_CONCEPTS_HPP
+#include <chrono>
#include <string>
#include <type_traits>
@@ -52,4 +53,17 @@ template <class T>
concept InputIterableStringContainer =
InputIterableContainer<T>and ContainsString<T>;
+// TODO(modernize): remove this once we require clang version >= 14.0.0
+template <typename T>
+concept ClockHasFromSys =
+ requires(std::chrono::time_point<std::chrono::system_clock> const tp) {
+ T::from_sys(tp);
+};
+
+// TODO(modernize): remove this once we require clang version >= 14.0.0
+template <typename T>
+concept ClockHasFromTime = requires(std::time_t const t) {
+ T::from_time_t(t);
+};
+
#endif // INCLUDED_SRC_UTILS_CPP_CONCEPTS_HPP