summaryrefslogtreecommitdiffstats
path: root/src/common/concepts.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/concepts.h')
-rw-r--r--src/common/concepts.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/common/concepts.h b/src/common/concepts.h
index db5fb373d..5bef3ad67 100644
--- a/src/common/concepts.h
+++ b/src/common/concepts.h
@@ -4,10 +4,10 @@
#pragma once
-namespace Common {
-
#include <type_traits>
+namespace Common {
+
// Check if type is like an STL container
template <typename T>
concept IsSTLContainer = requires(T t) {
@@ -23,10 +23,12 @@ concept IsSTLContainer = requires(T t) {
t.size();
};
-// Check if type T is derived from T2
-template <typename T, typename T2>
-concept IsBaseOf = requires {
- std::is_base_of_v<T, T2>;
+// TODO: Replace with std::derived_from when the <concepts> header
+// is available on all supported platforms.
+template <typename Derived, typename Base>
+concept DerivedFrom = requires {
+ std::is_base_of_v<Base, Derived>;
+ std::is_convertible_v<const volatile Derived*, const volatile Base*>;
};
} // namespace Common