1
0

2 Ревизии e0ce66c098 ... 7d5ce4ec3e

Автор SHA1 Съобщение Дата
  skypjack 7d5ce4ec3e stl: allow injecting ios преди 4 дни
  skypjack 19b2ed94e7 stl: allow injecting functional преди 4 дни
променени са 6 файла, в които са добавени 54 реда и са изтрити 14 реда
  1. 14 12
      src/entt/stl/functional.hpp
  2. 6 2
      src/entt/stl/ios.hpp
  3. 4 0
      test/entt/stl_ext/functional.cpp
  4. 4 0
      test/entt/stl_ext/ios.cpp
  5. 13 0
      test/include/entt/ext/stl/functional.hpp
  6. 13 0
      test/include/entt/ext/stl/ios.hpp

+ 14 - 12
src/entt/stl/functional.hpp

@@ -1,11 +1,14 @@
 #ifndef ENTT_STL_FUNCTIONAL_HPP
 #define ENTT_STL_FUNCTIONAL_HPP
 
-#include <functional>
-#include <version>
-#include "../config/config.h"
-
 /*! @cond ENTT_INTERNAL */
+#if __has_include(<entt/ext/stl/functional.hpp>)
+#    include <entt/ext/stl/functional.hpp>
+#else
+#    include <functional>
+#    include <version>
+#    include "../config/config.h"
+
 namespace entt::stl {
 
 using std::equal_to;
@@ -16,21 +19,19 @@ using std::less;
 
 } // namespace entt::stl
 
-#ifndef ENTT_FORCE_STL
-#    if defined(__cpp_lib_ranges)
-#        define ENTT_HAS_IDENTITY
-
+#    ifndef ENTT_FORCE_STL
+#        if defined(__cpp_lib_ranges)
+#            define ENTT_HAS_IDENTITY
 namespace entt::stl {
 
 using std::identity;
 
 } // namespace entt::stl
-
+#        endif
 #    endif
-#endif
 
-#ifndef ENTT_HAS_IDENTITY
-#    include <utility>
+#    ifndef ENTT_HAS_IDENTITY
+#        include <utility>
 
 namespace entt::stl {
 
@@ -44,6 +45,7 @@ struct identity {
 };
 
 } // namespace entt::stl
+#    endif
 
 #endif
 /*! @endcond */

+ 6 - 2
src/entt/stl/ios.hpp

@@ -1,14 +1,18 @@
 #ifndef ENTT_STL_IOS_HPP
 #define ENTT_STL_IOS_HPP
 
-#include <ios>
-
 /*! @cond ENTT_INTERNAL */
+#if __has_include(<entt/ext/stl/ios.hpp>)
+#    include <entt/ext/stl/ios.hpp>
+#else
+#    include <ios>
+
 namespace entt::stl {
 
 using std::boolalpha;
 
 } // namespace entt::stl
+#endif
 /*! @endcond */
 
 #endif

+ 4 - 0
test/entt/stl_ext/functional.cpp

@@ -1,2 +1,6 @@
 #include <gtest/gtest.h>
 #include <entt/stl/functional.hpp>
+
+TEST(Functional, HasInclude) {
+    static_assert(entt::stl::entt_ext_functional, "Header not properly included");
+}

+ 4 - 0
test/entt/stl_ext/ios.cpp

@@ -1,2 +1,6 @@
 #include <gtest/gtest.h>
 #include <entt/stl/ios.hpp>
+
+TEST(IOS, HasInclude) {
+    static_assert(entt::stl::entt_ext_ios, "Header not properly included");
+}

+ 13 - 0
test/include/entt/ext/stl/functional.hpp

@@ -0,0 +1,13 @@
+#ifndef ENTT_EXT_STL_FUNCTIONAL_HPP
+#define ENTT_EXT_STL_FUNCTIONAL_HPP
+
+/*! @cond ENTT_INTERNAL */
+#include <functional>
+
+namespace entt::stl {
+using namespace std;
+static constexpr auto entt_ext_functional = true;
+} // namespace entt::stl
+/*! @endcond */
+
+#endif

+ 13 - 0
test/include/entt/ext/stl/ios.hpp

@@ -0,0 +1,13 @@
+#ifndef ENTT_EXT_STL_IOS_HPP
+#define ENTT_EXT_STL_IOS_HPP
+
+/*! @cond ENTT_INTERNAL */
+#include <ios>
+
+namespace entt::stl {
+using namespace std;
+static constexpr auto entt_ext_ios = true;
+} // namespace entt::stl
+/*! @endcond */
+
+#endif