Prechádzať zdrojové kódy

stl: support injecting string

skypjack 2 dní pred
rodič
commit
62ae11b433

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

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

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

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

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

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