stl: <ranges> & co.

This commit is contained in:
skypjack
2026-04-24 15:22:55 +02:00
parent 9055a66364
commit 165c6df6a2
5 changed files with 37 additions and 18 deletions

View File

@@ -209,6 +209,7 @@ if(ENTT_INCLUDE_HEADERS)
stl/limits.hpp
stl/memory.hpp
stl/ostream.hpp
stl/ranges.hpp
stl/sstream.hpp
stl/string.hpp
stl/string_view.hpp

View File

@@ -1,20 +1,17 @@
#ifndef ENTT_CORE_RANGES_HPP
#define ENTT_CORE_RANGES_HPP
#include "../stl/version.hpp"
#include "../stl/ranges.hpp"
#ifdef ENTT_HAS_VERSION
# if defined(__cpp_lib_ranges)
# include <ranges>
# include "iterator.hpp"
#ifdef ENTT_HAS_RANGES
# include "iterator.hpp"
template<class... Args>
inline constexpr bool std::ranges::enable_borrowed_range<entt::iterable_adaptor<Args...>>{true};
inline constexpr bool entt::stl::ranges::enable_borrowed_range<entt::iterable_adaptor<Args...>>{true};
template<class... Args>
inline constexpr bool std::ranges::enable_view<entt::iterable_adaptor<Args...>>{true};
inline constexpr bool entt::stl::ranges::enable_view<entt::iterable_adaptor<Args...>>{true};
# endif
#endif
#endif

View File

@@ -1,26 +1,23 @@
#ifndef ENTT_ENTITY_RANGES_HPP
#define ENTT_ENTITY_RANGES_HPP
#include "../stl/version.hpp"
#include "../stl/ranges.hpp"
#ifdef ENTT_HAS_VERSION
# if defined(__cpp_lib_ranges)
# include <ranges>
# include "fwd.hpp"
#ifdef ENTT_HAS_RANGES
# include "fwd.hpp"
template<class... Args>
inline constexpr bool std::ranges::enable_borrowed_range<entt::basic_view<Args...>>{true};
inline constexpr bool entt::stl::ranges::enable_borrowed_range<entt::basic_view<Args...>>{true};
template<class... Args>
inline constexpr bool std::ranges::enable_borrowed_range<entt::basic_group<Args...>>{true};
inline constexpr bool entt::stl::ranges::enable_borrowed_range<entt::basic_group<Args...>>{true};
template<class... Args>
inline constexpr bool std::ranges::enable_view<entt::basic_view<Args...>>{true};
inline constexpr bool entt::stl::ranges::enable_view<entt::basic_view<Args...>>{true};
template<class... Args>
inline constexpr bool std::ranges::enable_view<entt::basic_group<Args...>>{true};
inline constexpr bool entt::stl::ranges::enable_view<entt::basic_group<Args...>>{true};
# endif
#endif
#endif

View File

@@ -83,6 +83,7 @@ namespace entt::stl {}
#include "stl/limits.hpp"
#include "stl/memory.hpp"
#include "stl/ostream.hpp"
#include "stl/ranges.hpp"
#include "stl/sstream.hpp"
#include "stl/string.hpp"
#include "stl/string_view.hpp"

23
src/entt/stl/ranges.hpp Normal file
View File

@@ -0,0 +1,23 @@
#ifndef ENTT_STL_RANGES_HPP
#define ENTT_STL_RANGES_HPP
#include "../stl/version.hpp"
#ifdef ENTT_HAS_VERSION
# if defined(__cpp_lib_ranges)
# include <ranges>
# define ENTT_HAS_RANGES
/*! @cond ENTT_INTERNAL */
namespace entt::stl::ranges {
using std::ranges::enable_borrowed_range;
using std::ranges::enable_view;
} // namespace entt::stl::ranges
/*! @endcond */
# endif
#endif
#endif