Răsfoiți Sursa

stl: allow injecting ostream

skypjack 1 lună în urmă
părinte
comite
e45a3f512d

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

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

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

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

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

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