summaryrefslogtreecommitdiff
path: root/src/common/concepts.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/concepts.h')
-rw-r--r--src/common/concepts.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/common/concepts.h b/src/common/concepts.h
new file mode 100644
index 000000000..db5fb373d
--- /dev/null
+++ b/src/common/concepts.h
@@ -0,0 +1,32 @@
1// Copyright 2020 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Common {
8
9#include <type_traits>
10
11// Check if type is like an STL container
12template <typename T>
13concept IsSTLContainer = requires(T t) {
14 typename T::value_type;
15 typename T::iterator;
16 typename T::const_iterator;
17 // TODO(ogniK): Replace below is std::same_as<void> when MSVC supports it.
18 t.begin();
19 t.end();
20 t.cbegin();
21 t.cend();
22 t.data();
23 t.size();
24};
25
26// Check if type T is derived from T2
27template <typename T, typename T2>
28concept IsBaseOf = requires {
29 std::is_base_of_v<T, T2>;
30};
31
32} // namespace Common