diff options
Diffstat (limited to 'src/common/concepts.h')
| -rw-r--r-- | src/common/concepts.h | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/common/concepts.h b/src/common/concepts.h index e8ce30dfe..a9acff3e7 100644 --- a/src/common/concepts.h +++ b/src/common/concepts.h | |||
| @@ -3,24 +3,14 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <iterator> | ||
| 6 | #include <type_traits> | 7 | #include <type_traits> |
| 7 | 8 | ||
| 8 | namespace Common { | 9 | namespace Common { |
| 9 | 10 | ||
| 10 | // Check if type is like an STL container | 11 | // Check if type satisfies the ContiguousContainer named requirement. |
| 11 | template <typename T> | 12 | template <typename T> |
| 12 | concept IsSTLContainer = requires(T t) { | 13 | concept IsContiguousContainer = std::contiguous_iterator<typename T::iterator>; |
| 13 | typename T::value_type; | ||
| 14 | typename T::iterator; | ||
| 15 | typename T::const_iterator; | ||
| 16 | // TODO(ogniK): Replace below is std::same_as<void> when MSVC supports it. | ||
| 17 | t.begin(); | ||
| 18 | t.end(); | ||
| 19 | t.cbegin(); | ||
| 20 | t.cend(); | ||
| 21 | t.data(); | ||
| 22 | t.size(); | ||
| 23 | }; | ||
| 24 | 14 | ||
| 25 | // TODO: Replace with std::derived_from when the <concepts> header | 15 | // TODO: Replace with std::derived_from when the <concepts> header |
| 26 | // is available on all supported platforms. | 16 | // is available on all supported platforms. |