소스 검색

stl: support injecting concepts

skypjack 5 일 전
부모
커밋
15a8fe19b4
3개의 변경된 파일23개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      src/entt/stl/concepts.hpp
  2. 4 0
      test/entt/stl_ext/concepts.cpp
  3. 13 0
      test/include/entt/ext/stl/concepts.hpp

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

@@ -1,9 +1,12 @@
 #ifndef ENTT_STL_CONCEPTS_HPP
 #ifndef ENTT_STL_CONCEPTS_HPP
 #define ENTT_STL_CONCEPTS_HPP
 #define ENTT_STL_CONCEPTS_HPP
 
 
-#include <concepts>
-
 /*! @cond ENTT_INTERNAL */
 /*! @cond ENTT_INTERNAL */
+#if __has_include(<entt/ext/stl/concepts.hpp>)
+#    include <entt/ext/stl/concepts.hpp>
+#else
+#    include <concepts>
+
 namespace entt::stl {
 namespace entt::stl {
 
 
 using std::constructible_from;
 using std::constructible_from;
@@ -15,6 +18,7 @@ using std::same_as;
 using std::unsigned_integral;
 using std::unsigned_integral;
 
 
 } // namespace entt::stl
 } // namespace entt::stl
+#endif
 /*! @endcond */
 /*! @endcond */
 
 
 #endif
 #endif

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

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

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

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