From 8b4d5aeb4f01348312ca38555d7951ff54b23fc3 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 26 Oct 2022 00:41:54 -0400 Subject: concepts: Use the std::contiguous_iterator concept This also covers std::span, which does not have a const iterator. Also renames IsSTLContainer to IsContiguousContainer to explicitly convey its semantics. --- src/common/concepts.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'src/common/concepts.h') 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 @@ #pragma once +#include #include namespace Common { -// Check if type is like an STL container +// Check if type satisfies the ContiguousContainer named requirement. template -concept IsSTLContainer = requires(T t) { - typename T::value_type; - typename T::iterator; - typename T::const_iterator; - // TODO(ogniK): Replace below is std::same_as when MSVC supports it. - t.begin(); - t.end(); - t.cbegin(); - t.cend(); - t.data(); - t.size(); -}; +concept IsContiguousContainer = std::contiguous_iterator; // TODO: Replace with std::derived_from when the header // is available on all supported platforms. -- cgit v1.2.3