diff options
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/memory.h | 10 |
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) { |