skypjack 5 месяцев назад
Родитель
Сommit
165c6df6a2
5 измененных файлов с 37 добавлено и 18 удалено
  1. 1 0
      CMakeLists.txt
  2. 5 8
      src/entt/core/ranges.hpp
  3. 7 10
      src/entt/entity/ranges.hpp
  4. 1 0
      src/entt/entt.hpp
  5. 23 0
      src/entt/stl/ranges.hpp

+ 1 - 0
CMakeLists.txt

@@ -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

+ 5 - 8
src/entt/core/ranges.hpp

@@ -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

+ 7 - 10
src/entt/entity/ranges.hpp

@@ -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

+ 1 - 0
src/entt/entt.hpp

@@ -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 - 0
src/entt/stl/ranges.hpp

@@ -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