Przeglądaj źródła

stl: allow injecting array

skypjack 1 tydzień temu
rodzic
commit
91f971845c

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

@@ -1,15 +1,19 @@
 #ifndef ENTT_STL_ARRAY_HPP
 #define ENTT_STL_ARRAY_HPP
 
-#include <array>
-
 /*! @cond ENTT_INTERNAL */
+#if __has_include(<entt/ext/stl/array.hpp>)
+#    include <entt/ext/stl/array.hpp>
+#else
+#    include <array>
+
 namespace entt::stl {
 
 using std::array;
 using std::get;
 
 } // namespace entt::stl
+#endif
 /*! @endcond */
 
 #endif

+ 4 - 1
test/entt/stl_ext/array.cpp

@@ -1,3 +1,6 @@
-#include <memory>
 #include <gtest/gtest.h>
 #include <entt/stl/array.hpp>
+
+TEST(Array, HasInclude) {
+    static_assert(entt::stl::entt_ext_array, "Header not properly included");
+}

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

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