aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2022-01-05 12:14:48 +0100
committerMartin Ridgers <[email protected]>2022-01-05 15:15:47 +0100
commitf8e264954eca759ce0589ea25fbb3354f3f31bfe (patch)
tree41ea019e2bb7225dbd2b4ab46e9a9aaf5fe4ccbb /zencore/include
parentFunction parameter case consistency with the rest of the code base (diff)
downloadzen-f8e264954eca759ce0589ea25fbb3354f3f31bfe.tar.xz
zen-f8e264954eca759ce0589ea25fbb3354f3f31bfe.zip
Contiguous range concepts for C++ libs that don't support them yet
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/memory.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/zencore/include/zencore/memory.h b/zencore/include/zencore/memory.h
index ef4d3bdbd..40a3be18c 100644
--- a/zencore/include/zencore/memory.h
+++ b/zencore/include/zencore/memory.h
@@ -14,6 +14,12 @@
namespace zen {
+#if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L
+ template <typename T> concept ContiguousRange = std::ranges::contiguous_range<T>;
+#else
+ template <typename T> concept ContiguousRange = true;
+#endif
+
struct MemoryView;
class MemoryArena
@@ -337,7 +343,7 @@ MakeMemoryView(std::initializer_list<typename std::type_identity<T>::type> List)
}
/** Make a non-owning view of the memory of the contiguous container. */
-template<std::ranges::contiguous_range R>
+template<ContiguousRange R>
[[nodiscard]] constexpr inline MemoryView
MakeMemoryView(const R& Container)
{
@@ -372,7 +378,7 @@ MakeMutableMemoryView(std::initializer_list<typename std::type_identity<T>::type
}
/** Make a non-owning mutable view of the memory of the contiguous container. */
-template<std::ranges::contiguous_range R>
+template<ContiguousRange R>
[[nodiscard]] constexpr inline MutableMemoryView
MakeMutableMemoryView(R& Container)
{