Browse Source

core: export more types as fwd decl - close #1114

Michele Caini 2 years ago
parent
commit
5ecc254a91

+ 1 - 0
src/entt/core/compressed_pair.hpp

@@ -5,6 +5,7 @@
 #include <tuple>
 #include <type_traits>
 #include <utility>
+#include "fwd.hpp"
 #include "type_traits.hpp"
 
 namespace entt {

+ 14 - 0
src/entt/core/fwd.hpp

@@ -15,6 +15,20 @@ using id_type = ENTT_ID_TYPE;
 /*! @brief Alias declaration for the most common use case. */
 using any = basic_any<>;
 
+template<typename, typename>
+class compressed_pair;
+
+template<typename>
+class basic_hashed_string;
+
+/*! @brief Aliases for common character types. */
+using hashed_string = basic_hashed_string<char>;
+
+/*! @brief Aliases for common character types. */
+using hashed_wstring = basic_hashed_string<wchar_t>;
+
+struct type_info;
+
 } // namespace entt
 
 #endif

+ 0 - 6
src/entt/core/hashed_string.hpp

@@ -293,12 +293,6 @@ template<typename Char>
     return !(lhs < rhs);
 }
 
-/*! @brief Aliases for common character types. */
-using hashed_string = basic_hashed_string<char>;
-
-/*! @brief Aliases for common character types. */
-using hashed_wstring = basic_hashed_string<wchar_t>;
-
 inline namespace literals {
 
 /**

+ 6 - 6
src/entt/core/type_info.hpp

@@ -246,6 +246,12 @@ private:
  * @return A reference to a properly initialized type info object.
  */
 template<typename Type>
+[[nodiscard]] const type_info &type_id(Type &&) noexcept {
+    return type_id<std::remove_cv_t<std::remove_reference_t<Type>>>();
+}
+
+/*! @copydoc type_id */
+template<typename Type>
 [[nodiscard]] const type_info &type_id() noexcept {
     if constexpr(std::is_same_v<Type, std::remove_cv_t<std::remove_reference_t<Type>>>) {
         static type_info instance{std::in_place_type<Type>};
@@ -255,12 +261,6 @@ template<typename Type>
     }
 }
 
-/*! @copydoc type_id */
-template<typename Type>
-[[nodiscard]] const type_info &type_id(Type &&) noexcept {
-    return type_id<std::remove_cv_t<std::remove_reference_t<Type>>>();
-}
-
 } // namespace entt
 
 #endif