Przeglądaj źródła

stl: tuple header

skypjack 3 dni temu
rodzic
commit
3652d47932

+ 1 - 0
CMakeLists.txt

@@ -198,6 +198,7 @@ if(ENTT_INCLUDE_HEADERS)
         stl/functional.hpp
         stl/iterator.hpp
         stl/memory.hpp
+        stl/tuple.hpp
         stl/vector.hpp
         tools/davey.hpp
         entt.hpp

+ 6 - 6
src/entt/container/dense_map.hpp

@@ -10,7 +10,6 @@
 #include <iterator>
 #include <limits>
 #include <memory>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
@@ -20,6 +19,7 @@
 #include "../core/memory.hpp"
 #include "../core/type_traits.hpp"
 #include "../stl/iterator.hpp"
+#include "../stl/tuple.hpp"
 #include "../stl/vector.hpp"
 #include "fwd.hpp"
 
@@ -273,7 +273,7 @@ class dense_map {
             return std::make_pair(it, false);
         }
 
-        packed.first().emplace_back(sparse.first()[index], std::piecewise_construct, std::forward_as_tuple(std::forward<Other>(key)), std::forward_as_tuple(std::forward<Args>(args)...));
+        packed.first().emplace_back(sparse.first()[index], std::piecewise_construct, stl::forward_as_tuple(std::forward<Other>(key)), stl::forward_as_tuple(std::forward<Args>(args)...));
         sparse.first()[index] = packed.first().size() - 1u;
         rehash_if_required();
 
@@ -392,8 +392,8 @@ public:
      * @param allocator The allocator to use.
      */
     dense_map(const dense_map &other, const allocator_type &allocator)
-        : sparse{std::piecewise_construct, std::forward_as_tuple(other.sparse.first(), allocator), std::forward_as_tuple(other.sparse.second())},
-          packed{std::piecewise_construct, std::forward_as_tuple(other.packed.first(), allocator), std::forward_as_tuple(other.packed.second())},
+        : sparse{std::piecewise_construct, stl::forward_as_tuple(other.sparse.first(), allocator), stl::forward_as_tuple(other.sparse.second())},
+          packed{std::piecewise_construct, stl::forward_as_tuple(other.packed.first(), allocator), stl::forward_as_tuple(other.packed.second())},
           threshold{other.threshold} {}
 
     /*! @brief Default move constructor. */
@@ -405,8 +405,8 @@ public:
      * @param allocator The allocator to use.
      */
     dense_map(dense_map &&other, const allocator_type &allocator)
-        : sparse{std::piecewise_construct, std::forward_as_tuple(std::move(other.sparse.first()), allocator), std::forward_as_tuple(std::move(other.sparse.second()))},
-          packed{std::piecewise_construct, std::forward_as_tuple(std::move(other.packed.first()), allocator), std::forward_as_tuple(std::move(other.packed.second()))},
+        : sparse{std::piecewise_construct, stl::forward_as_tuple(std::move(other.sparse.first()), allocator), stl::forward_as_tuple(std::move(other.sparse.second()))},
+          packed{std::piecewise_construct, stl::forward_as_tuple(std::move(other.packed.first()), allocator), stl::forward_as_tuple(std::move(other.packed.second()))},
           threshold{other.threshold} {}
 
     /*! @brief Default destructor. */

+ 6 - 6
src/entt/container/dense_set.hpp

@@ -10,7 +10,6 @@
 #include <iterator>
 #include <limits>
 #include <memory>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
@@ -18,6 +17,7 @@
 #include "../core/compressed_pair.hpp"
 #include "../core/type_traits.hpp"
 #include "../stl/iterator.hpp"
+#include "../stl/tuple.hpp"
 #include "../stl/vector.hpp"
 #include "fwd.hpp"
 
@@ -341,8 +341,8 @@ public:
      * @param allocator The allocator to use.
      */
     dense_set(const dense_set &other, const allocator_type &allocator)
-        : sparse{std::piecewise_construct, std::forward_as_tuple(other.sparse.first(), allocator), std::forward_as_tuple(other.sparse.second())},
-          packed{std::piecewise_construct, std::forward_as_tuple(other.packed.first(), allocator), std::forward_as_tuple(other.packed.second())},
+        : sparse{std::piecewise_construct, stl::forward_as_tuple(other.sparse.first(), allocator), stl::forward_as_tuple(other.sparse.second())},
+          packed{std::piecewise_construct, stl::forward_as_tuple(other.packed.first(), allocator), stl::forward_as_tuple(other.packed.second())},
           threshold{other.threshold} {}
 
     /*! @brief Default move constructor. */
@@ -354,8 +354,8 @@ public:
      * @param allocator The allocator to use.
      */
     dense_set(dense_set &&other, const allocator_type &allocator)
-        : sparse{std::piecewise_construct, std::forward_as_tuple(std::move(other.sparse.first()), allocator), std::forward_as_tuple(std::move(other.sparse.second()))},
-          packed{std::piecewise_construct, std::forward_as_tuple(std::move(other.packed.first()), allocator), std::forward_as_tuple(std::move(other.packed.second()))},
+        : sparse{std::piecewise_construct, stl::forward_as_tuple(std::move(other.sparse.first()), allocator), stl::forward_as_tuple(std::move(other.sparse.second()))},
+          packed{std::piecewise_construct, stl::forward_as_tuple(std::move(other.packed.first()), allocator), stl::forward_as_tuple(std::move(other.packed.second()))},
           threshold{other.threshold} {}
 
     /*! @brief Default destructor. */
@@ -548,7 +548,7 @@ public:
         if constexpr(((sizeof...(Args) == 1u) && ... && std::is_same_v<std::decay_t<Args>, value_type>)) {
             return insert_or_do_nothing(std::forward<Args>(args)...);
         } else {
-            auto &node = packed.first().emplace_back(std::piecewise_construct, std::make_tuple(packed.first().size()), std::forward_as_tuple(std::forward<Args>(args)...));
+            auto &node = packed.first().emplace_back(std::piecewise_construct, stl::make_tuple(packed.first().size()), stl::forward_as_tuple(std::forward<Args>(args)...));
             const auto index = value_to_bucket(node.second);
 
             if(auto it = constrained_find(node.second, index); it != end()) {

+ 12 - 12
src/entt/container/table.hpp

@@ -4,10 +4,10 @@
 #include <concepts>
 #include <cstddef>
 #include <iterator>
-#include <tuple>
 #include <utility>
 #include "../config/config.h"
 #include "../core/iterator.hpp"
+#include "../stl/tuple.hpp"
 #include "fwd.hpp"
 
 namespace entt {
@@ -21,7 +21,7 @@ class table_iterator {
     friend class table_iterator;
 
 public:
-    using value_type = decltype(std::forward_as_tuple(*std::declval<It>()...));
+    using value_type = decltype(stl::forward_as_tuple(*std::declval<It>()...));
     using pointer = input_iterator_pointer<value_type>;
     using reference = value_type;
     using difference_type = std::ptrdiff_t;
@@ -75,7 +75,7 @@ public:
     }
 
     [[nodiscard]] constexpr reference operator[](const difference_type value) const noexcept {
-        return std::forward_as_tuple(std::get<It>(it)[value]...);
+        return stl::forward_as_tuple(std::get<It>(it)[value]...);
     }
 
     [[nodiscard]] constexpr pointer operator->() const noexcept {
@@ -102,7 +102,7 @@ public:
     }
 
 private:
-    std::tuple<It...> it;
+    stl::tuple<It...> it;
 };
 
 } // namespace internal
@@ -119,7 +119,7 @@ private:
  */
 template<typename... Container>
 class basic_table {
-    using container_type = std::tuple<Container...>;
+    using container_type = stl::tuple<Container...>;
 
 public:
     /*! @brief Unsigned integer type. */
@@ -365,11 +365,11 @@ public:
      * @return A reference to the newly created row data.
      */
     template<typename... Args>
-    std::tuple<typename Container::value_type &...> emplace(Args &&...args) {
+    stl::tuple<typename Container::value_type &...> emplace(Args &&...args) {
         if constexpr(sizeof...(Args) == 0u) {
-            return std::forward_as_tuple(std::get<Container>(payload).emplace_back()...);
+            return stl::forward_as_tuple(std::get<Container>(payload).emplace_back()...);
         } else {
-            return std::forward_as_tuple(std::get<Container>(payload).emplace_back(std::forward<Args>(args))...);
+            return stl::forward_as_tuple(std::get<Container>(payload).emplace_back(std::forward<Args>(args))...);
         }
     }
 
@@ -397,15 +397,15 @@ public:
      * @param pos The row for which to return the data.
      * @return The row data at specified location.
      */
-    [[nodiscard]] std::tuple<const typename Container::value_type &...> operator[](const size_type pos) const {
+    [[nodiscard]] stl::tuple<const typename Container::value_type &...> operator[](const size_type pos) const {
         ENTT_ASSERT(pos < size(), "Index out of bounds");
-        return std::forward_as_tuple(std::get<Container>(payload)[pos]...);
+        return stl::forward_as_tuple(std::get<Container>(payload)[pos]...);
     }
 
     /*! @copydoc operator[] */
-    [[nodiscard]] std::tuple<typename Container::value_type &...> operator[](const size_type pos) {
+    [[nodiscard]] stl::tuple<typename Container::value_type &...> operator[](const size_type pos) {
         ENTT_ASSERT(pos < size(), "Index out of bounds");
-        return std::forward_as_tuple(std::get<Container>(payload)[pos]...);
+        return stl::forward_as_tuple(std::get<Container>(payload)[pos]...);
     }
 
     /*! @brief Clears a table. */

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

@@ -3,9 +3,9 @@
 
 #include <concepts>
 #include <cstddef>
-#include <tuple>
 #include <type_traits>
 #include <utility>
+#include "../stl/tuple.hpp"
 #include "fwd.hpp"
 #include "type_traits.hpp"
 
@@ -29,7 +29,7 @@ struct compressed_pair_element {
         : value{std::forward<Arg>(arg)} {}
 
     template<typename... Args, std::size_t... Index>
-    constexpr compressed_pair_element(std::tuple<Args...> args, std::index_sequence<Index...>) noexcept(std::is_nothrow_constructible_v<Type, Args...>)
+    constexpr compressed_pair_element(stl::tuple<Args...> args, std::index_sequence<Index...>) noexcept(std::is_nothrow_constructible_v<Type, Args...>)
         : value{std::forward<Args>(std::get<Index>(args))...} {}
 
     [[nodiscard]] constexpr reference get() noexcept {
@@ -61,7 +61,7 @@ struct compressed_pair_element<Type, Tag>: Type {
         : base_type{std::forward<Arg>(arg)} {}
 
     template<typename... Args, std::size_t... Index>
-    constexpr compressed_pair_element(std::tuple<Args...> args, std::index_sequence<Index...>) noexcept(std::is_nothrow_constructible_v<base_type, Args...>)
+    constexpr compressed_pair_element(stl::tuple<Args...> args, std::index_sequence<Index...>) noexcept(std::is_nothrow_constructible_v<base_type, Args...>)
         : base_type{std::forward<Args>(std::get<Index>(args))...} {}
 
     [[nodiscard]] constexpr reference get() noexcept {
@@ -141,7 +141,7 @@ public:
      * @param other Arguments to use to initialize the second element.
      */
     template<typename... Args, typename... Other>
-    constexpr compressed_pair(std::piecewise_construct_t, std::tuple<Args...> args, std::tuple<Other...> other) noexcept(std::is_nothrow_constructible_v<first_base, Args...> && std::is_nothrow_constructible_v<second_base, Other...>)
+    constexpr compressed_pair(std::piecewise_construct_t, stl::tuple<Args...> args, stl::tuple<Other...> other) noexcept(std::is_nothrow_constructible_v<first_base, Args...> && std::is_nothrow_constructible_v<second_base, Other...>)
         : first_base{std::move(args), std::index_sequence_for<Args...>{}},
           second_base{std::move(other), std::index_sequence_for<Other...>{}} {}
 
@@ -251,7 +251,7 @@ constexpr void swap(compressed_pair<First, Second> &lhs, compressed_pair<First,
 namespace std {
 
 /**
- * @brief `std::tuple_size` specialization for `compressed_pair`s.
+ * @brief `stl::tuple_size` specialization for `compressed_pair`s.
  * @tparam First The type of the first element that the pair stores.
  * @tparam Second The type of the second element that the pair stores.
  */
@@ -259,7 +259,7 @@ template<typename First, typename Second>
 struct tuple_size<entt::compressed_pair<First, Second>>: integral_constant<size_t, 2u> {};
 
 /**
- * @brief `std::tuple_element` specialization for `compressed_pair`s.
+ * @brief `stl::tuple_element` specialization for `compressed_pair`s.
  * @tparam Index The index of the type to return.
  * @tparam First The type of the first element that the pair stores.
  * @tparam Second The type of the second element that the pair stores.

+ 12 - 12
src/entt/core/memory.hpp

@@ -3,11 +3,11 @@
 
 #include <cstddef>
 #include <memory>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
 #include "../stl/memory.hpp"
+#include "../stl/tuple.hpp"
 
 namespace entt {
 
@@ -120,15 +120,15 @@ struct uses_allocator_construction {
     template<typename Allocator, typename... Params>
     static constexpr auto args([[maybe_unused]] const Allocator &allocator, Params &&...params) noexcept {
         if constexpr(!std::uses_allocator_v<Type, Allocator> && std::is_constructible_v<Type, Params...>) {
-            return std::forward_as_tuple(std::forward<Params>(params)...);
+            return stl::forward_as_tuple(std::forward<Params>(params)...);
         } else {
             static_assert(std::uses_allocator_v<Type, Allocator>, "Ill-formed request");
 
             if constexpr(std::is_constructible_v<Type, std::allocator_arg_t, const Allocator &, Params...>) {
-                return std::tuple<std::allocator_arg_t, const Allocator &, Params &&...>{std::allocator_arg, allocator, std::forward<Params>(params)...};
+                return stl::tuple<std::allocator_arg_t, const Allocator &, Params &&...>{std::allocator_arg, allocator, std::forward<Params>(params)...};
             } else {
                 static_assert(std::is_constructible_v<Type, Params..., const Allocator &>, "Ill-formed request");
-                return std::forward_as_tuple(std::forward<Params>(params)..., allocator);
+                return stl::forward_as_tuple(std::forward<Params>(params)..., allocator);
             }
         }
     }
@@ -140,29 +140,29 @@ struct uses_allocator_construction<std::pair<Type, Other>> {
 
     template<typename First, typename Second>
     static constexpr auto args(const auto &allocator, std::piecewise_construct_t, First &&first, Second &&second) noexcept {
-        return std::make_tuple(
+        return stl::make_tuple(
             std::piecewise_construct,
-            std::apply([&allocator](auto &&...curr) { return uses_allocator_construction<Type>::args(allocator, std::forward<decltype(curr)>(curr)...); }, std::forward<First>(first)),
-            std::apply([&allocator](auto &&...curr) { return uses_allocator_construction<Other>::args(allocator, std::forward<decltype(curr)>(curr)...); }, std::forward<Second>(second)));
+            stl::apply([&allocator](auto &&...curr) { return uses_allocator_construction<Type>::args(allocator, std::forward<decltype(curr)>(curr)...); }, std::forward<First>(first)),
+            stl::apply([&allocator](auto &&...curr) { return uses_allocator_construction<Other>::args(allocator, std::forward<decltype(curr)>(curr)...); }, std::forward<Second>(second)));
     }
 
     static constexpr auto args(const auto &allocator) noexcept {
-        return uses_allocator_construction<type>::args(allocator, std::piecewise_construct, std::tuple<>{}, std::tuple<>{});
+        return uses_allocator_construction<type>::args(allocator, std::piecewise_construct, stl::tuple<>{}, stl::tuple<>{});
     }
 
     template<typename First, typename Second>
     static constexpr auto args(const auto &allocator, First &&first, Second &&second) noexcept {
-        return uses_allocator_construction<type>::args(allocator, std::piecewise_construct, std::forward_as_tuple(std::forward<First>(first)), std::forward_as_tuple(std::forward<Second>(second)));
+        return uses_allocator_construction<type>::args(allocator, std::piecewise_construct, stl::forward_as_tuple(std::forward<First>(first)), stl::forward_as_tuple(std::forward<Second>(second)));
     }
 
     template<typename First, typename Second>
     static constexpr auto args(const auto &allocator, const std::pair<First, Second> &value) noexcept {
-        return uses_allocator_construction<type>::args(allocator, std::piecewise_construct, std::forward_as_tuple(value.first), std::forward_as_tuple(value.second));
+        return uses_allocator_construction<type>::args(allocator, std::piecewise_construct, stl::forward_as_tuple(value.first), stl::forward_as_tuple(value.second));
     }
 
     template<typename First, typename Second>
     static constexpr auto args(const auto &allocator, std::pair<First, Second> &&value) noexcept {
-        return uses_allocator_construction<type>::args(allocator, std::piecewise_construct, std::forward_as_tuple(std::move(value.first)), std::forward_as_tuple(std::move(value.second)));
+        return uses_allocator_construction<type>::args(allocator, std::piecewise_construct, stl::forward_as_tuple(std::move(value.first)), stl::forward_as_tuple(std::move(value.second)));
     }
 };
 
@@ -218,7 +218,7 @@ constexpr Type make_obj_using_allocator(const auto &allocator, Args &&...args) {
  */
 template<typename Type, typename... Args>
 constexpr Type *uninitialized_construct_using_allocator(Type *value, const auto &allocator, Args &&...args) {
-    return std::apply([value](auto &&...curr) { return ::new(value) Type(std::forward<decltype(curr)>(curr)...); }, internal::uses_allocator_construction<Type>::args(allocator, std::forward<Args>(args)...));
+    return stl::apply([value](auto &&...curr) { return ::new(value) Type(std::forward<decltype(curr)>(curr)...); }, internal::uses_allocator_construction<Type>::args(allocator, std::forward<Args>(args)...));
 }
 
 } // namespace entt

+ 7 - 7
src/entt/core/tuple.hpp

@@ -1,9 +1,9 @@
 #ifndef ENTT_CORE_TUPLE_HPP
 #define ENTT_CORE_TUPLE_HPP
 
-#include <tuple>
 #include <type_traits>
 #include <utility>
+#include "../stl/tuple.hpp"
 
 namespace entt {
 
@@ -20,7 +20,7 @@ struct is_tuple: std::false_type {};
  * @tparam Args Tuple template arguments.
  */
 template<typename... Args>
-struct is_tuple<std::tuple<Args...>>: std::true_type {};
+struct is_tuple<stl::tuple<Args...>>: std::true_type {};
 
 /**
  * @brief Helper variable template.
@@ -38,7 +38,7 @@ inline constexpr bool is_tuple_v = is_tuple<Type>::value;
  */
 template<typename Type>
 constexpr decltype(auto) unwrap_tuple(Type &&value) noexcept {
-    if constexpr(std::tuple_size_v<std::remove_reference_t<Type>> == 1u) {
+    if constexpr(stl::tuple_size_v<std::remove_reference_t<Type>> == 1u) {
         return std::get<0>(std::forward<Type>(value));
     } else {
         return std::forward<Type>(value);
@@ -67,14 +67,14 @@ struct forward_apply: private Func {
      * @return Return value of the underlying function, if any.
      */
     template<typename Type>
-    constexpr decltype(auto) operator()(Type &&args) noexcept(noexcept(std::apply(std::declval<Func &>(), args))) {
-        return std::apply(static_cast<Func &>(*this), std::forward<Type>(args));
+    constexpr decltype(auto) operator()(Type &&args) noexcept(noexcept(stl::apply(std::declval<Func &>(), args))) {
+        return stl::apply(static_cast<Func &>(*this), std::forward<Type>(args));
     }
 
     /*! @copydoc operator()() */
     template<typename Type>
-    constexpr decltype(auto) operator()(Type &&args) const noexcept(noexcept(std::apply(std::declval<const Func &>(), args))) {
-        return std::apply(static_cast<const Func &>(*this), std::forward<Type>(args));
+    constexpr decltype(auto) operator()(Type &&args) const noexcept(noexcept(stl::apply(std::declval<const Func &>(), args))) {
+        return stl::apply(static_cast<const Func &>(*this), std::forward<Type>(args));
     }
 };
 

+ 10 - 10
src/entt/core/type_traits.hpp

@@ -4,10 +4,10 @@
 #include <concepts>
 #include <cstddef>
 #include <iterator>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
+#include "../stl/tuple.hpp"
 #include "fwd.hpp"
 
 namespace entt {
@@ -619,7 +619,7 @@ struct is_applicable_r: std::false_type {};
  * @tparam Args The list of arguments to use to probe the function type.
  */
 template<typename Ret, typename Func, typename... Args>
-struct is_applicable_r<Ret, Func, std::tuple<Args...>>: std::is_invocable_r<Ret, Func, Args...> {};
+struct is_applicable_r<Ret, Func, stl::tuple<Args...>>: std::is_invocable_r<Ret, Func, Args...> {};
 
 /**
  * @brief Helper variable template.
@@ -726,7 +726,7 @@ template<typename>
 struct has_tuple_size_value: std::false_type {};
 
 template<typename Type>
-requires is_complete_v<std::tuple_size<const Type>>
+requires is_complete_v<stl::tuple_size<const Type>>
 struct has_tuple_size_value<Type>: std::true_type {};
 
 template<typename>
@@ -741,7 +741,7 @@ template<typename>
 
 template<typename Type, std::size_t... Index>
 [[nodiscard]] ENTT_CONSTEVAL bool unpack_maybe_equality_comparable(std::index_sequence<Index...>) {
-    return (dispatch_is_equality_comparable<std::tuple_element_t<Index, Type>>() && ...);
+    return (dispatch_is_equality_comparable<stl::tuple_element_t<Index, Type>>() && ...);
 }
 
 template<typename>
@@ -759,9 +759,9 @@ template<typename Type>
     // NOLINTBEGIN(modernize-use-transparent-functors)
     if constexpr(std::is_array_v<Type>) {
         return false;
-    } else if constexpr(is_complete_v<std::tuple_size<std::remove_const_t<Type>>>) {
+    } else if constexpr(is_complete_v<stl::tuple_size<std::remove_const_t<Type>>>) {
         if constexpr(has_tuple_size_value<Type>::value) {
-            return maybe_equality_comparable<Type>(0) && unpack_maybe_equality_comparable<Type>(std::make_index_sequence<std::tuple_size<Type>::value>{});
+            return maybe_equality_comparable<Type>(0) && unpack_maybe_equality_comparable<Type>(std::make_index_sequence<stl::tuple_size<Type>::value>{});
         } else {
             return maybe_equality_comparable<Type>(0);
         }
@@ -892,15 +892,15 @@ using nth_argument_t = nth_argument<Index, Candidate>::type;
 } // namespace entt
 
 template<typename... Type>
-struct std::tuple_size<entt::type_list<Type...>>: std::integral_constant<std::size_t, entt::type_list<Type...>::size> {};
+struct entt::stl::tuple_size<entt::type_list<Type...>>: std::integral_constant<std::size_t, entt::type_list<Type...>::size> {};
 
 template<std::size_t Index, typename... Type>
-struct std::tuple_element<Index, entt::type_list<Type...>>: entt::type_list_element<Index, entt::type_list<Type...>> {};
+struct entt::stl::tuple_element<Index, entt::type_list<Type...>>: entt::type_list_element<Index, entt::type_list<Type...>> {};
 
 template<auto... Value>
-struct std::tuple_size<entt::value_list<Value...>>: std::integral_constant<std::size_t, entt::value_list<Value...>::size> {};
+struct entt::stl::tuple_size<entt::value_list<Value...>>: std::integral_constant<std::size_t, entt::value_list<Value...>::size> {};
 
 template<std::size_t Index, auto... Value>
-struct std::tuple_element<Index, entt::value_list<Value...>>: entt::value_list_element<Index, entt::value_list<Value...>> {};
+struct entt::stl::tuple_element<Index, entt::value_list<Value...>>: entt::value_list_element<Index, entt::value_list<Value...>> {};
 
 #endif

+ 42 - 42
src/entt/entity/group.hpp

@@ -5,7 +5,6 @@
 #include <concepts>
 #include <cstddef>
 #include <iterator>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
@@ -15,6 +14,7 @@
 #include "../core/type_info.hpp"
 #include "../core/type_traits.hpp"
 #include "../stl/iterator.hpp"
+#include "../stl/tuple.hpp"
 #include "entity.hpp"
 #include "fwd.hpp"
 
@@ -31,15 +31,15 @@ class extended_group_iterator<It, owned_t<Owned...>, get_t<Get...>> {
     template<typename Type>
     [[nodiscard]] auto index_to_element([[maybe_unused]] Type &cpool) const {
         if constexpr(std::is_void_v<typename Type::value_type>) {
-            return std::make_tuple();
+            return stl::make_tuple();
         } else {
-            return std::forward_as_tuple(cpool.rbegin()[it.index()]);
+            return stl::forward_as_tuple(cpool.rbegin()[it.index()]);
         }
     }
 
 public:
     using iterator_type = It;
-    using value_type = decltype(std::tuple_cat(std::make_tuple(*std::declval<It>()), std::declval<Owned>().get_as_tuple({})..., std::declval<Get>().get_as_tuple({})...));
+    using value_type = decltype(stl::tuple_cat(stl::make_tuple(*std::declval<It>()), std::declval<Owned>().get_as_tuple({})..., std::declval<Get>().get_as_tuple({})...));
     using pointer = input_iterator_pointer<value_type>;
     using reference = value_type;
     using difference_type = std::ptrdiff_t;
@@ -50,7 +50,7 @@ public:
         : it{},
           pools{} {}
 
-    extended_group_iterator(iterator_type from, std::tuple<Owned *..., Get *...> cpools)
+    extended_group_iterator(iterator_type from, stl::tuple<Owned *..., Get *...> cpools)
         : it{from},
           pools{std::move(cpools)} {}
 
@@ -64,7 +64,7 @@ public:
     }
 
     [[nodiscard]] reference operator*() const noexcept {
-        return std::tuple_cat(std::make_tuple(*it), index_to_element(*std::get<Owned *>(pools))..., std::get<Get *>(pools)->get_as_tuple(*it)...);
+        return stl::tuple_cat(stl::make_tuple(*it), index_to_element(*std::get<Owned *>(pools))..., std::get<Get *>(pools)->get_as_tuple(*it)...);
     }
 
     [[nodiscard]] pointer operator->() const noexcept {
@@ -82,7 +82,7 @@ public:
 
 private:
     It it;
-    std::tuple<Owned *..., Get *...> pools;
+    stl::tuple<Owned *..., Get *...> pools;
 };
 
 struct group_descriptor {
@@ -104,15 +104,15 @@ class group_handler final: public group_descriptor {
     }
 
     void push_on_construct(const entity_type entt) {
-        if(std::apply([entt, pos = len](auto *cpool, auto *...other) { return cpool->contains(entt) && !(cpool->index(entt) < pos) && (other->contains(entt) && ...); }, pools)
-           && std::apply([entt](auto *...cpool) { return (!cpool->contains(entt) && ...); }, filter)) {
+        if(stl::apply([entt, pos = len](auto *cpool, auto *...other) { return cpool->contains(entt) && !(cpool->index(entt) < pos) && (other->contains(entt) && ...); }, pools)
+           && stl::apply([entt](auto *...cpool) { return (!cpool->contains(entt) && ...); }, filter)) {
             swap_elements(len++, entt);
         }
     }
 
     void push_on_destroy(const entity_type entt) {
-        if(std::apply([entt, pos = len](auto *cpool, auto *...other) { return cpool->contains(entt) && !(cpool->index(entt) < pos) && (other->contains(entt) && ...); }, pools)
-           && std::apply([entt](auto *...cpool) { return (0u + ... + cpool->contains(entt)) == 1u; }, filter)) {
+        if(stl::apply([entt, pos = len](auto *cpool, auto *...other) { return cpool->contains(entt) && !(cpool->index(entt) < pos) && (other->contains(entt) && ...); }, pools)
+           && stl::apply([entt](auto *...cpool) { return (0u + ... + cpool->contains(entt)) == 1u; }, filter)) {
             swap_elements(len++, entt);
         }
     }
@@ -135,11 +135,11 @@ public:
     using size_type = Type::size_type;
 
     template<typename... OGType, typename... EType>
-    group_handler(std::tuple<OGType &...> ogpool, std::tuple<EType &...> epool)
-        : pools{std::apply([](auto &&...cpool) { return std::array<common_type *, (Owned + Get)>{&cpool...}; }, ogpool)},
-          filter{std::apply([](auto &&...cpool) { return std::array<common_type *, Exclude>{&cpool...}; }, epool)} {
-        std::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::push_on_construct>(*this), cpool.on_destroy().template connect<&group_handler::remove_if>(*this)), ...); }, ogpool);
-        std::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::remove_if>(*this), cpool.on_destroy().template connect<&group_handler::push_on_destroy>(*this)), ...); }, epool);
+    group_handler(stl::tuple<OGType &...> ogpool, stl::tuple<EType &...> epool)
+        : pools{stl::apply([](auto &&...cpool) { return std::array<common_type *, (Owned + Get)>{&cpool...}; }, ogpool)},
+          filter{stl::apply([](auto &&...cpool) { return std::array<common_type *, Exclude>{&cpool...}; }, epool)} {
+        stl::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::push_on_construct>(*this), cpool.on_destroy().template connect<&group_handler::remove_if>(*this)), ...); }, ogpool);
+        stl::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::remove_if>(*this), cpool.on_destroy().template connect<&group_handler::push_on_destroy>(*this)), ...); }, epool);
         common_setup();
     }
 
@@ -178,16 +178,16 @@ class group_handler<Type, 0u, Get, Exclude> final: public group_descriptor {
 
     void push_on_construct(const entity_type entt) {
         if(!elem.contains(entt)
-           && std::apply([entt](auto *...cpool) { return (cpool->contains(entt) && ...); }, pools)
-           && std::apply([entt](auto *...cpool) { return (!cpool->contains(entt) && ...); }, filter)) {
+           && stl::apply([entt](auto *...cpool) { return (cpool->contains(entt) && ...); }, pools)
+           && stl::apply([entt](auto *...cpool) { return (!cpool->contains(entt) && ...); }, filter)) {
             elem.push(entt);
         }
     }
 
     void push_on_destroy(const entity_type entt) {
         if(!elem.contains(entt)
-           && std::apply([entt](auto *...cpool) { return (cpool->contains(entt) && ...); }, pools)
-           && std::apply([entt](auto *...cpool) { return (0u + ... + cpool->contains(entt)) == 1u; }, filter)) {
+           && stl::apply([entt](auto *...cpool) { return (cpool->contains(entt) && ...); }, pools)
+           && stl::apply([entt](auto *...cpool) { return (0u + ... + cpool->contains(entt)) == 1u; }, filter)) {
             elem.push(entt);
         }
     }
@@ -206,12 +206,12 @@ public:
     using common_type = Type;
 
     template<typename Allocator, typename... GType, typename... EType>
-    group_handler(const Allocator &allocator, std::tuple<GType &...> gpool, std::tuple<EType &...> epool)
-        : pools{std::apply([](auto &&...cpool) { return std::array<common_type *, Get>{&cpool...}; }, gpool)},
-          filter{std::apply([](auto &&...cpool) { return std::array<common_type *, Exclude>{&cpool...}; }, epool)},
+    group_handler(const Allocator &allocator, stl::tuple<GType &...> gpool, stl::tuple<EType &...> epool)
+        : pools{stl::apply([](auto &&...cpool) { return std::array<common_type *, Get>{&cpool...}; }, gpool)},
+          filter{stl::apply([](auto &&...cpool) { return std::array<common_type *, Exclude>{&cpool...}; }, epool)},
           elem{allocator} {
-        std::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::push_on_construct>(*this), cpool.on_destroy().template connect<&group_handler::remove_if>(*this)), ...); }, gpool);
-        std::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::remove_if>(*this), cpool.on_destroy().template connect<&group_handler::push_on_destroy>(*this)), ...); }, epool);
+        stl::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::push_on_construct>(*this), cpool.on_destroy().template connect<&group_handler::remove_if>(*this)), ...); }, gpool);
+        stl::apply([this](auto &...cpool) { ((cpool.on_construct().template connect<&group_handler::remove_if>(*this), cpool.on_destroy().template connect<&group_handler::push_on_destroy>(*this)), ...); }, epool);
         common_setup();
     }
 
@@ -282,7 +282,7 @@ class basic_group<owned_t<>, get_t<Get...>, exclude_t<Exclude...>> {
 
     template<std::size_t... Index>
     [[nodiscard]] auto pools_for(std::index_sequence<Index...>) const noexcept {
-        using return_type = std::tuple<Get *...>;
+        using return_type = stl::tuple<Get *...>;
         return descriptor ? return_type{static_cast<Get *>(descriptor->template storage<Index>())...} : return_type{};
     }
 
@@ -504,11 +504,11 @@ public:
         const auto cpools = pools_for(std::index_sequence_for<Get...>{});
 
         if constexpr(sizeof...(Index) == 0) {
-            return std::apply([entt](auto *...curr) { return std::tuple_cat(curr->get_as_tuple(entt)...); }, cpools);
+            return stl::apply([entt](auto *...curr) { return stl::tuple_cat(curr->get_as_tuple(entt)...); }, cpools);
         } else if constexpr(sizeof...(Index) == 1) {
             return (std::get<Index>(cpools)->get(entt), ...);
         } else {
-            return std::tuple_cat(std::get<Index>(cpools)->get_as_tuple(entt)...);
+            return stl::tuple_cat(std::get<Index>(cpools)->get_as_tuple(entt)...);
         }
     }
 
@@ -537,10 +537,10 @@ public:
     template<typename Func>
     void each(Func func) const {
         for(const auto entt: *this) {
-            if constexpr(is_applicable_v<Func, decltype(std::tuple_cat(std::tuple<entity_type>{}, std::declval<basic_group>().get({})))>) {
-                std::apply(func, std::tuple_cat(std::make_tuple(entt), get(entt)));
+            if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, std::declval<basic_group>().get({})))>) {
+                stl::apply(func, stl::tuple_cat(stl::make_tuple(entt), get(entt)));
             } else {
-                std::apply(func, get(entt));
+                stl::apply(func, get(entt));
             }
         }
     }
@@ -571,7 +571,7 @@ public:
      * comparison function should be equivalent to one of the following:
      *
      * @code{.cpp}
-     * bool(std::tuple<Type &...>, std::tuple<Type &...>);
+     * bool(stl::tuple<Type &...>, stl::tuple<Type &...>);
      * bool(const Type &..., const Type &...);
      * bool(const Entity, const Entity);
      * @endcode
@@ -625,7 +625,7 @@ public:
                     if constexpr(sizeof...(Index) == 1) {
                         return compare((std::get<Index>(cpools)->get(lhs), ...), (std::get<Index>(cpools)->get(rhs), ...));
                     } else {
-                        return compare(std::forward_as_tuple(std::get<Index>(cpools)->get(lhs)...), std::forward_as_tuple(std::get<Index>(cpools)->get(rhs)...));
+                        return compare(stl::forward_as_tuple(std::get<Index>(cpools)->get(lhs)...), stl::forward_as_tuple(std::get<Index>(cpools)->get(rhs)...));
                     }
                 };
 
@@ -696,7 +696,7 @@ class basic_group<owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> {
 
     template<std::size_t... Index, std::size_t... Other>
     [[nodiscard]] auto pools_for(std::index_sequence<Index...>, std::index_sequence<Other...>) const noexcept {
-        using return_type = std::tuple<Owned *..., Get *...>;
+        using return_type = stl::tuple<Owned *..., Get *...>;
         return descriptor ? return_type{static_cast<Owned *>(descriptor->template storage<Index>())..., static_cast<Get *>(descriptor->template storage<sizeof...(Owned) + Other>())...} : return_type{};
     }
 
@@ -903,11 +903,11 @@ public:
         const auto cpools = pools_for(std::index_sequence_for<Owned...>{}, std::index_sequence_for<Get...>{});
 
         if constexpr(sizeof...(Index) == 0) {
-            return std::apply([entt](auto *...curr) { return std::tuple_cat(curr->get_as_tuple(entt)...); }, cpools);
+            return stl::apply([entt](auto *...curr) { return stl::tuple_cat(curr->get_as_tuple(entt)...); }, cpools);
         } else if constexpr(sizeof...(Index) == 1) {
             return (std::get<Index>(cpools)->get(entt), ...);
         } else {
-            return std::tuple_cat(std::get<Index>(cpools)->get_as_tuple(entt)...);
+            return stl::tuple_cat(std::get<Index>(cpools)->get_as_tuple(entt)...);
         }
     }
 
@@ -936,10 +936,10 @@ public:
     template<typename Func>
     void each(Func func) const {
         for(auto args: each()) {
-            if constexpr(is_applicable_v<Func, decltype(std::tuple_cat(std::tuple<entity_type>{}, std::declval<basic_group>().get({})))>) {
-                std::apply(func, args);
+            if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, std::declval<basic_group>().get({})))>) {
+                stl::apply(func, args);
             } else {
-                std::apply([&func](auto, auto &&...less) { func(std::forward<decltype(less)>(less)...); }, args);
+                stl::apply([&func](auto, auto &&...less) { func(std::forward<decltype(less)>(less)...); }, args);
             }
         }
     }
@@ -970,7 +970,7 @@ public:
      * comparison function should be equivalent to one of the following:
      *
      * @code{.cpp}
-     * bool(std::tuple<Type &...>, std::tuple<Type &...>);
+     * bool(stl::tuple<Type &...>, stl::tuple<Type &...>);
      * bool(const Type &, const Type &);
      * bool(const Entity, const Entity);
      * @endcode
@@ -1026,7 +1026,7 @@ public:
                 if constexpr(sizeof...(Index) == 1) {
                     return compare((std::get<Index>(cpools)->get(lhs), ...), (std::get<Index>(cpools)->get(rhs), ...));
                 } else {
-                    return compare(std::forward_as_tuple(std::get<Index>(cpools)->get(lhs)...), std::forward_as_tuple(std::get<Index>(cpools)->get(rhs)...));
+                    return compare(stl::forward_as_tuple(std::get<Index>(cpools)->get(lhs)...), stl::forward_as_tuple(std::get<Index>(cpools)->get(rhs)...));
                 }
             };
 
@@ -1041,7 +1041,7 @@ public:
             }
         };
 
-        std::apply(cb, cpools);
+        stl::apply(cb, cpools);
     }
 
 private:

+ 1 - 1
src/entt/entity/handle.hpp

@@ -2,12 +2,12 @@
 #define ENTT_ENTITY_HANDLE_HPP
 
 #include <iterator>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
 #include "../core/iterator.hpp"
 #include "../core/type_traits.hpp"
+#include "../stl/tuple.hpp"
 #include "entity.hpp"
 #include "fwd.hpp"
 

+ 3 - 3
src/entt/entity/organizer.hpp

@@ -148,7 +148,7 @@ class basic_organizer final {
 
     template<typename... Args>
     [[nodiscard]] static auto to_args(Registry &reg, type_list<Args...>) {
-        return std::tuple<decltype(extract<Args>(reg))...>(extract<Args>(reg)...);
+        return stl::tuple<decltype(extract<Args>(reg))...>(extract<Args>(reg)...);
     }
 
     template<typename... Type>
@@ -320,7 +320,7 @@ public:
         using resource_type = decltype(internal::free_function_to_resource_traits<registry_type, Req...>(Candidate));
 
         callback_type *callback = +[](const void *, registry_type &reg) {
-            std::apply(Candidate, to_args(reg, typename resource_type::args{}));
+            stl::apply(Candidate, to_args(reg, typename resource_type::args{}));
         };
 
         vertex_data vdata{
@@ -352,7 +352,7 @@ public:
 
         callback_type *callback = +[](const void *payload, registry_type &reg) {
             Type *curr = static_cast<Type *>(const_cast<constness_as_t<void, Type> *>(payload));
-            std::apply(Candidate, std::tuple_cat(std::forward_as_tuple(*curr), to_args(reg, typename resource_type::args{})));
+            stl::apply(Candidate, stl::tuple_cat(stl::forward_as_tuple(*curr), to_args(reg, typename resource_type::args{})));
         };
 
         vertex_data vdata{

+ 11 - 11
src/entt/entity/registry.hpp

@@ -9,7 +9,6 @@
 #include <functional>
 #include <iterator>
 #include <memory>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
@@ -24,6 +23,7 @@
 #include "../core/type_traits.hpp"
 #include "../stl/functional.hpp"
 #include "../stl/iterator.hpp"
+#include "../stl/tuple.hpp"
 #include "entity.hpp"
 #include "fwd.hpp"
 #include "group.hpp"
@@ -710,8 +710,8 @@ public:
             }
 
         } else {
-            for(auto cpools = std::forward_as_tuple(assure<Type>(), assure<Other>()...); first != last; ++first) {
-                count += std::apply([entt = *first](auto &...curr) { return (curr.remove(entt) + ... + 0u); }, cpools);
+            for(auto cpools = stl::forward_as_tuple(assure<Type>(), assure<Other>()...); first != last; ++first) {
+                count += stl::apply([entt = *first](auto &...curr) { return (curr.remove(entt) + ... + 0u); }, cpools);
             }
         }
 
@@ -760,8 +760,8 @@ public:
                 (*from)->erase(first, last);
             }
         } else {
-            for(auto cpools = std::forward_as_tuple(assure<Type>(), assure<Other>()...); first != last; ++first) {
-                std::apply([entt = *first](auto &...curr) { (curr.erase(entt), ...); }, cpools);
+            for(auto cpools = stl::forward_as_tuple(assure<Type>(), assure<Other>()...); first != last; ++first) {
+                stl::apply([entt = *first](auto &...curr) { (curr.erase(entt), ...); }, cpools);
             }
         }
     }
@@ -850,7 +850,7 @@ public:
         if constexpr(sizeof...(Type) == 1u) {
             return (assure<std::remove_const_t<Type>>()->get(entt), ...);
         } else {
-            return std::forward_as_tuple(get<Type>(entt)...);
+            return stl::forward_as_tuple(get<Type>(entt)...);
         }
     }
 
@@ -860,7 +860,7 @@ public:
         if constexpr(sizeof...(Type) == 1u) {
             return (static_cast<storage_for_type<Type> &>(assure<std::remove_const_t<Type>>()).get(entt), ...);
         } else {
-            return std::forward_as_tuple(get<Type>(entt)...);
+            return stl::forward_as_tuple(get<Type>(entt)...);
         }
     }
 
@@ -902,7 +902,7 @@ public:
             const auto *cpool = assure<std::remove_const_t<Type>...>();
             return (cpool && cpool->contains(entt)) ? std::addressof(cpool->get(entt)) : nullptr;
         } else {
-            return std::make_tuple(try_get<Type>(entt)...);
+            return stl::make_tuple(try_get<Type>(entt)...);
         }
     }
 
@@ -912,7 +912,7 @@ public:
         if constexpr(sizeof...(Type) == 1u) {
             return (const_cast<Type *>(std::as_const(*this).template try_get<Type>(entt)), ...);
         } else {
-            return std::make_tuple(try_get<Type>(entt)...);
+            return stl::make_tuple(try_get<Type>(entt)...);
         }
     }
 
@@ -1057,9 +1057,9 @@ public:
         std::shared_ptr<handler_type> handler{};
 
         if constexpr(sizeof...(Owned) == 0u) {
-            handler = std::allocate_shared<handler_type>(get_allocator(), get_allocator(), std::forward_as_tuple(assure<std::remove_const_t<Get>>()...), std::forward_as_tuple(assure<std::remove_const_t<Exclude>>()...));
+            handler = std::allocate_shared<handler_type>(get_allocator(), get_allocator(), stl::forward_as_tuple(assure<std::remove_const_t<Get>>()...), stl::forward_as_tuple(assure<std::remove_const_t<Exclude>>()...));
         } else {
-            handler = std::allocate_shared<handler_type>(get_allocator(), std::forward_as_tuple(assure<std::remove_const_t<Owned>>()..., assure<std::remove_const_t<Get>>()...), std::forward_as_tuple(assure<std::remove_const_t<Exclude>>()...));
+            handler = std::allocate_shared<handler_type>(get_allocator(), stl::forward_as_tuple(assure<std::remove_const_t<Owned>>()..., assure<std::remove_const_t<Get>>()...), stl::forward_as_tuple(assure<std::remove_const_t<Exclude>>()...));
             ENTT_ASSERT(std::all_of(groups.cbegin(), groups.cend(), [](const auto &data) { return !(data.second->owned(type_id<Owned>().hash()) || ...); }), "Conflicting groups");
         }
 

+ 6 - 6
src/entt/entity/snapshot.hpp

@@ -4,13 +4,13 @@
 #include <concepts>
 #include <cstddef>
 #include <iterator>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
 #include "../container/dense_map.hpp"
 #include "../core/type_traits.hpp"
 #include "../stl/iterator.hpp"
+#include "../stl/tuple.hpp"
 #include "entity.hpp"
 #include "fwd.hpp"
 #include "view.hpp"
@@ -108,12 +108,12 @@ public:
                         archive(static_cast<entity_type>(null));
                     } else {
                         archive(entt);
-                        std::apply([&archive](auto &&...args) { (archive(std::forward<decltype(args)>(args)), ...); }, storage->get_as_tuple(entt));
+                        stl::apply([&archive](auto &&...args) { (archive(std::forward<decltype(args)>(args)), ...); }, storage->get_as_tuple(entt));
                     }
                 }
             } else {
                 for(auto elem: storage->reach()) {
-                    std::apply([&archive](auto &&...args) { (archive(std::forward<decltype(args)>(args)), ...); }, elem);
+                    stl::apply([&archive](auto &&...args) { (archive(std::forward<decltype(args)>(args)), ...); }, elem);
                 }
             }
         } else {
@@ -144,7 +144,7 @@ public:
             for(; first != last; ++first) {
                 if(const auto entt = *first; storage->contains(entt)) {
                     archive(entt);
-                    std::apply([&archive](auto &&...args) { (archive(std::forward<decltype(args)>(args)), ...); }, storage->get_as_tuple(entt));
+                    stl::apply([&archive](auto &&...args) { (archive(std::forward<decltype(args)>(args)), ...); }, storage->get_as_tuple(entt));
                 } else {
                     archive(static_cast<entity_type>(null));
                 }
@@ -251,7 +251,7 @@ public:
                     const auto entity = other.contains(entt) ? entt : other.generate(entt);
                     ENTT_ASSERT(entity == entt, "Entity not available for use");
 
-                    if constexpr(std::tuple_size_v<decltype(storage.get_as_tuple({}))> == 0u) {
+                    if constexpr(stl::tuple_size_v<decltype(storage.get_as_tuple({}))> == 0u) {
                         storage.emplace(entity);
                     } else {
                         Type elem{};
@@ -448,7 +448,7 @@ public:
                 if(archive(entt); entt != null) {
                     restore(entt);
 
-                    if constexpr(std::tuple_size_v<decltype(storage.get_as_tuple({}))> == 0u) {
+                    if constexpr(stl::tuple_size_v<decltype(storage.get_as_tuple({}))> == 0u) {
                         storage.emplace(map(entt));
                     } else {
                         Type elem{};

+ 11 - 11
src/entt/entity/storage.hpp

@@ -6,7 +6,6 @@
 #include <cstddef>
 #include <iterator>
 #include <memory>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
@@ -16,6 +15,7 @@
 #include "../core/type_info.hpp"
 #include "../stl/iterator.hpp"
 #include "../stl/memory.hpp"
+#include "../stl/tuple.hpp"
 #include "../stl/vector.hpp"
 #include "component.hpp"
 #include "entity.hpp"
@@ -140,7 +140,7 @@ class extended_storage_iterator final {
 
 public:
     using iterator_type = It;
-    using value_type = decltype(std::tuple_cat(std::make_tuple(*std::declval<It>()), std::forward_as_tuple(*std::declval<Other>()...)));
+    using value_type = decltype(stl::tuple_cat(stl::make_tuple(*std::declval<It>()), stl::forward_as_tuple(*std::declval<Other>()...)));
     using pointer = input_iterator_pointer<value_type>;
     using reference = value_type;
     using difference_type = std::ptrdiff_t;
@@ -185,7 +185,7 @@ public:
     }
 
 private:
-    std::tuple<It, Other...> it;
+    stl::tuple<It, Other...> it;
 };
 
 } // namespace internal
@@ -645,13 +645,13 @@ public:
      * @param entt A valid identifier.
      * @return The object assigned to the entity as a tuple.
      */
-    [[nodiscard]] std::tuple<const value_type &> get_as_tuple(const entity_type entt) const noexcept {
-        return std::forward_as_tuple(get(entt));
+    [[nodiscard]] stl::tuple<const value_type &> get_as_tuple(const entity_type entt) const noexcept {
+        return stl::forward_as_tuple(get(entt));
     }
 
     /*! @copydoc get_as_tuple */
-    [[nodiscard]] std::tuple<value_type &> get_as_tuple(const entity_type entt) noexcept {
-        return std::forward_as_tuple(get(entt));
+    [[nodiscard]] stl::tuple<value_type &> get_as_tuple(const entity_type entt) noexcept {
+        return stl::forward_as_tuple(get(entt));
     }
 
     /**
@@ -877,9 +877,9 @@ public:
      * @param entt A valid identifier.
      * @return Returns an empty tuple.
      */
-    [[nodiscard]] std::tuple<> get_as_tuple([[maybe_unused]] const entity_type entt) const noexcept {
+    [[nodiscard]] stl::tuple<> get_as_tuple([[maybe_unused]] const entity_type entt) const noexcept {
         ENTT_ASSERT(base_type::contains(entt), "Invalid entity");
-        return std::tuple{};
+        return stl::tuple{};
     }
 
     /**
@@ -1105,9 +1105,9 @@ public:
      * @param entt A valid identifier.
      * @return Returns an empty tuple.
      */
-    [[nodiscard]] std::tuple<> get_as_tuple([[maybe_unused]] const entity_type entt) const noexcept {
+    [[nodiscard]] stl::tuple<> get_as_tuple([[maybe_unused]] const entity_type entt) const noexcept {
         ENTT_ASSERT(base_type::index(entt) < base_type::free_list(), "The requested entity is not a live one");
-        return std::tuple{};
+        return stl::tuple{};
     }
 
     /**

+ 17 - 17
src/entt/entity/view.hpp

@@ -5,13 +5,13 @@
 #include <concepts>
 #include <cstddef>
 #include <iterator>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
 #include "../core/concepts.hpp"
 #include "../core/iterator.hpp"
 #include "../core/type_traits.hpp"
+#include "../stl/tuple.hpp"
 #include "entity.hpp"
 #include "fwd.hpp"
 
@@ -131,7 +131,7 @@ private:
 template<typename It, typename... Get>
 struct extended_view_iterator final {
     using iterator_type = It;
-    using value_type = decltype(std::tuple_cat(std::make_tuple(*std::declval<It>()), std::declval<Get>().get_as_tuple({})...));
+    using value_type = decltype(stl::tuple_cat(stl::make_tuple(*std::declval<It>()), std::declval<Get>().get_as_tuple({})...));
     using pointer = input_iterator_pointer<value_type>;
     using reference = value_type;
     using difference_type = std::ptrdiff_t;
@@ -155,7 +155,7 @@ struct extended_view_iterator final {
 
     [[nodiscard]] reference operator*() const noexcept {
         return [this]<auto... Index>(std::index_sequence<Index...>) {
-            return std::tuple_cat(std::make_tuple(*it), static_cast<Get *>(const_cast<constness_as_t<typename Get::base_type, Get> *>(std::get<Index>(it.pools)))->get_as_tuple(*it)...);
+            return stl::tuple_cat(stl::make_tuple(*it), static_cast<Get *>(const_cast<constness_as_t<typename Get::base_type, Get> *>(std::get<Index>(it.pools)))->get_as_tuple(*it)...);
         }(std::index_sequence_for<Get...>{});
     }
 
@@ -418,9 +418,9 @@ class basic_view<get_t<Get...>, exclude_t<Exclude...>>
     static constexpr std::size_t index_of = type_list_index_v<std::remove_const_t<Type>, type_list<typename Get::element_type..., typename Exclude::element_type...>>;
 
     template<std::size_t Curr, std::size_t Other, typename... Args>
-    [[nodiscard]] auto dispatch_get(const std::tuple<typename base_type::entity_type, Args...> &curr) const {
+    [[nodiscard]] auto dispatch_get(const stl::tuple<typename base_type::entity_type, Args...> &curr) const {
         if constexpr(Curr == Other) {
-            return std::forward_as_tuple(std::get<Args>(curr)...);
+            return stl::forward_as_tuple(std::get<Args>(curr)...);
         } else {
             return storage<Other>()->get_as_tuple(std::get<0>(curr));
         }
@@ -430,10 +430,10 @@ class basic_view<get_t<Get...>, exclude_t<Exclude...>>
     void each(Func func, std::index_sequence<Index...>) const {
         for(const auto curr: storage<Curr>()->each()) {
             if(const auto entt = std::get<0>(curr); (!internal::tombstone_check_v<Get...> || (entt != tombstone)) && ((Curr == Index || base_type::pool_at(Index)->contains(entt)) && ...) && base_type::none_of(entt)) {
-                if constexpr(is_applicable_v<Func, decltype(std::tuple_cat(std::tuple<entity_type>{}, std::declval<basic_view>().get({})))>) {
-                    std::apply(func, std::tuple_cat(std::make_tuple(entt), dispatch_get<Curr, Index>(curr)...));
+                if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, std::declval<basic_view>().get({})))>) {
+                    stl::apply(func, stl::tuple_cat(stl::make_tuple(entt), dispatch_get<Curr, Index>(curr)...));
                 } else {
-                    std::apply(func, std::tuple_cat(dispatch_get<Curr, Index>(curr)...));
+                    stl::apply(func, stl::tuple_cat(dispatch_get<Curr, Index>(curr)...));
                 }
             }
         }
@@ -478,8 +478,8 @@ public:
      * @param value The storage for the types to iterate.
      * @param excl The storage for the types used to filter the view.
      */
-    basic_view(std::tuple<Get &...> value, std::tuple<Exclude &...> excl = {}) noexcept
-        : basic_view{std::make_from_tuple<basic_view>(std::tuple_cat(value, excl))} {}
+    basic_view(stl::tuple<Get &...> value, stl::tuple<Exclude &...> excl = {}) noexcept
+        : basic_view{stl::make_from_tuple<basic_view>(stl::tuple_cat(value, excl))} {}
 
     /**
      * @brief Constructs a view from a convertible counterpart.
@@ -594,12 +594,12 @@ public:
     [[nodiscard]] decltype(auto) get(const entity_type entt) const {
         if constexpr(sizeof...(Index) == 0) {
             return [this, entt]<auto... Idx>(std::index_sequence<Idx...>) {
-                return std::tuple_cat(this->storage<Idx>()->get_as_tuple(entt)...);
+                return stl::tuple_cat(this->storage<Idx>()->get_as_tuple(entt)...);
             }(std::index_sequence_for<Get...>{});
         } else if constexpr(sizeof...(Index) == 1) {
             return (storage<Index>()->get(entt), ...);
         } else {
-            return std::tuple_cat(storage<Index>()->get_as_tuple(entt)...);
+            return stl::tuple_cat(storage<Index>()->get_as_tuple(entt)...);
         }
     }
 
@@ -936,7 +936,7 @@ public:
      * @brief Constructs a view from a storage class.
      * @param value The storage for the type to iterate.
      */
-    basic_view(std::tuple<Get &> value, std::tuple<> = {}) noexcept
+    basic_view(stl::tuple<Get &> value, stl::tuple<> = {}) noexcept
         : basic_view{std::get<0>(value)} {}
 
     /**
@@ -1053,9 +1053,9 @@ public:
      */
     template<typename Func>
     void each(Func func) const {
-        if constexpr(is_applicable_v<Func, decltype(std::tuple_cat(std::tuple<entity_type>{}, std::declval<basic_view>().get({})))>) {
+        if constexpr(is_applicable_v<Func, decltype(stl::tuple_cat(stl::tuple<entity_type>{}, std::declval<basic_view>().get({})))>) {
             for(const auto pack: each()) {
-                std::apply(func, pack);
+                stl::apply(func, pack);
             }
         } else if constexpr(Get::storage_policy == deletion_policy::swap_and_pop || Get::storage_policy == deletion_policy::swap_only) {
             if constexpr(std::is_void_v<typename Get::value_type>) {
@@ -1073,7 +1073,7 @@ public:
             static_assert(Get::storage_policy == deletion_policy::in_place, "Unexpected storage policy");
 
             for(const auto pack: each()) {
-                std::apply([&func](const auto, auto &&...elem) { func(std::forward<decltype(elem)>(elem)...); }, pack);
+                stl::apply([&func](const auto, auto &&...elem) { func(std::forward<decltype(elem)>(elem)...); }, pack);
             }
         }
     }
@@ -1135,7 +1135,7 @@ basic_view(Type &...storage) -> basic_view<get_t<Type...>, exclude_t<>>;
  * @tparam Exclude Types of elements used to filter the view.
  */
 template<typename... Get, typename... Exclude>
-basic_view(std::tuple<Get &...>, std::tuple<Exclude &...> = {}) -> basic_view<get_t<Get...>, exclude_t<Exclude...>>;
+basic_view(stl::tuple<Get &...>, stl::tuple<Exclude &...> = {}) -> basic_view<get_t<Get...>, exclude_t<Exclude...>>;
 
 } // namespace entt
 

+ 1 - 0
src/entt/entt.hpp

@@ -72,5 +72,6 @@ namespace entt::stl {}
 #include "stl/functional.hpp"
 #include "stl/iterator.hpp"
 #include "stl/memory.hpp"
+#include "stl/tuple.hpp"
 #include "stl/vector.hpp"
 // IWYU pragma: end_exports

+ 2 - 2
src/entt/meta/container.hpp

@@ -25,8 +25,8 @@ template<typename Type>
 struct sequence_container_extent: integral_constant<meta_dynamic_extent> {};
 
 template<typename Type>
-requires is_complete_v<std::tuple_size<Type>>
-struct sequence_container_extent<Type>: integral_constant<std::tuple_size_v<Type>> {};
+requires is_complete_v<stl::tuple_size<Type>>
+struct sequence_container_extent<Type>: integral_constant<stl::tuple_size_v<Type>> {};
 
 template<typename Type>
 inline constexpr std::size_t sequence_container_extent_v = sequence_container_extent<Type>::value;

+ 0 - 1
src/entt/meta/factory.hpp

@@ -6,7 +6,6 @@
 #include <cstdint>
 #include <functional>
 #include <memory>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"

+ 5 - 5
src/entt/poly/poly.hpp

@@ -4,13 +4,13 @@
 #include <concepts>
 #include <cstddef>
 #include <functional>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../core/any.hpp"
 #include "../core/concepts.hpp"
 #include "../core/type_info.hpp"
 #include "../core/type_traits.hpp"
+#include "../stl/tuple.hpp"
 #include "fwd.hpp"
 
 namespace entt {
@@ -70,14 +70,14 @@ class poly_vtable {
 
     template<auto... Candidate>
     static auto make_vtable(value_list<Candidate...>) noexcept
-        -> decltype(std::make_tuple(vtable_entry(Candidate)...));
+        -> decltype(stl::make_tuple(vtable_entry(Candidate)...));
 
     template<typename... Func>
     [[nodiscard]] static ENTT_CONSTEVAL auto make_vtable(type_list<Func...>) noexcept {
         if constexpr(sizeof...(Func) == 0u) {
             return decltype(make_vtable(typename Concept::template impl<inspector>{})){};
         } else if constexpr((std::is_function_v<Func> && ...)) {
-            return decltype(std::make_tuple(vtable_entry(std::declval<Func inspector::*>())...)){};
+            return decltype(stl::make_tuple(vtable_entry(std::declval<Func inspector::*>())...)){};
         }
     }
 
@@ -102,11 +102,11 @@ class poly_vtable {
     }
 
     using vtable_type = decltype(make_vtable(Concept{}));
-    static constexpr bool is_mono = std::tuple_size_v<vtable_type> == 1u;
+    static constexpr bool is_mono = stl::tuple_size_v<vtable_type> == 1u;
 
 public:
     /*! @brief Virtual table type. */
-    using type = std::conditional_t<is_mono, std::tuple_element_t<0u, vtable_type>, const vtable_type *>;
+    using type = std::conditional_t<is_mono, stl::tuple_element_t<0u, vtable_type>, const vtable_type *>;
 
     /**
      * @brief Returns a static virtual table for a specific concept and type.

+ 3 - 3
src/entt/resource/cache.hpp

@@ -7,7 +7,6 @@
 #include <functional>
 #include <iterator>
 #include <memory>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../container/dense_map.hpp"
@@ -15,6 +14,7 @@
 #include "../core/fwd.hpp"
 #include "../core/iterator.hpp"
 #include "../stl/functional.hpp"
+#include "../stl/tuple.hpp"
 #include "fwd.hpp"
 #include "loader.hpp"
 #include "resource.hpp"
@@ -172,7 +172,7 @@ public:
      * @param allocator The allocator to use.
      */
     resource_cache(const resource_cache &other, const allocator_type &allocator)
-        : pool{std::piecewise_construct, std::forward_as_tuple(other.pool.first(), allocator), std::forward_as_tuple(other.pool.second())} {}
+        : pool{std::piecewise_construct, stl::forward_as_tuple(other.pool.first(), allocator), stl::forward_as_tuple(other.pool.second())} {}
 
     /*! @brief Default move constructor. */
     resource_cache(resource_cache &&) noexcept = default;
@@ -183,7 +183,7 @@ public:
      * @param allocator The allocator to use.
      */
     resource_cache(resource_cache &&other, const allocator_type &allocator)
-        : pool{std::piecewise_construct, std::forward_as_tuple(std::move(other.pool.first()), allocator), std::forward_as_tuple(std::move(other.pool.second()))} {}
+        : pool{std::piecewise_construct, stl::forward_as_tuple(std::move(other.pool.first()), allocator), stl::forward_as_tuple(std::move(other.pool.second()))} {}
 
     /*! @brief Default destructor. */
     ~resource_cache() = default;

+ 4 - 4
src/entt/signal/delegate.hpp

@@ -3,11 +3,11 @@
 
 #include <cstddef>
 #include <functional>
-#include <tuple>
 #include <type_traits>
 #include <utility>
 #include "../config/config.h"
 #include "../core/type_traits.hpp"
+#include "../stl/tuple.hpp"
 #include "fwd.hpp"
 
 namespace entt {
@@ -71,7 +71,7 @@ class delegate<Ret(Args...)> {
     template<auto Candidate, std::size_t... Index>
     [[nodiscard]] auto wrap(std::index_sequence<Index...>) noexcept {
         return [](const void *, Args... args) -> return_type {
-            [[maybe_unused]] const auto arguments = std::forward_as_tuple(std::forward<Args>(args)...);
+            [[maybe_unused]] const auto arguments = stl::forward_as_tuple(std::forward<Args>(args)...);
             [[maybe_unused]] constexpr auto offset = !std::is_invocable_r_v<Ret, decltype(Candidate), type_list_element_t<Index, type_list<Args...>>...> * (sizeof...(Args) - sizeof...(Index));
             return static_cast<Ret>(std::invoke(Candidate, std::forward<type_list_element_t<Index + offset, type_list<Args...>>>(std::get<Index + offset>(arguments))...));
         };
@@ -81,7 +81,7 @@ class delegate<Ret(Args...)> {
     [[nodiscard]] auto wrap(Type &, std::index_sequence<Index...>) noexcept {
         return [](const void *payload, Args... args) -> return_type {
             Type *curr = static_cast<Type *>(const_cast<constness_as_t<void, Type> *>(payload));
-            [[maybe_unused]] const auto arguments = std::forward_as_tuple(std::forward<Args>(args)...);
+            [[maybe_unused]] const auto arguments = stl::forward_as_tuple(std::forward<Args>(args)...);
             [[maybe_unused]] constexpr auto offset = !std::is_invocable_r_v<Ret, decltype(Candidate), Type &, type_list_element_t<Index, type_list<Args...>>...> * (sizeof...(Args) - sizeof...(Index));
             return static_cast<Ret>(std::invoke(Candidate, *curr, std::forward<type_list_element_t<Index + offset, type_list<Args...>>>(std::get<Index + offset>(arguments))...));
         };
@@ -91,7 +91,7 @@ class delegate<Ret(Args...)> {
     [[nodiscard]] auto wrap(Type *, std::index_sequence<Index...>) noexcept {
         return [](const void *payload, Args... args) -> return_type {
             Type *curr = static_cast<Type *>(const_cast<constness_as_t<void, Type> *>(payload));
-            [[maybe_unused]] const auto arguments = std::forward_as_tuple(std::forward<Args>(args)...);
+            [[maybe_unused]] const auto arguments = stl::forward_as_tuple(std::forward<Args>(args)...);
             [[maybe_unused]] constexpr auto offset = !std::is_invocable_r_v<Ret, decltype(Candidate), Type *, type_list_element_t<Index, type_list<Args...>>...> * (sizeof...(Args) - sizeof...(Index));
             return static_cast<Ret>(std::invoke(Candidate, curr, std::forward<type_list_element_t<Index + offset, type_list<Args...>>>(std::get<Index + offset>(arguments))...));
         };

+ 25 - 0
src/entt/stl/tuple.hpp

@@ -0,0 +1,25 @@
+#ifndef ENTT_STL_TUPLE_HPP
+#define ENTT_STL_TUPLE_HPP
+
+#include "../config/config.h"
+
+#include <tuple>
+
+/*! @cond ENTT_INTERNAL */
+namespace entt::stl {
+
+using std::apply;
+using std::forward_as_tuple;
+using std::make_from_tuple;
+using std::make_tuple;
+using std::tuple;
+using std::tuple_cat;
+using std::tuple_element;
+using std::tuple_element_t;
+using std::tuple_size;
+using std::tuple_size_v;
+
+} // namespace entt::stl
+/*! @endcond */
+
+#endif