stl: internal changes

This commit is contained in:
skypjack
2026-03-26 18:31:26 +01:00
parent 0ebf837e6a
commit 171700153e
3 changed files with 31 additions and 10 deletions

View File

@@ -4,8 +4,6 @@
#include "../config/config.h"
/*! @cond ENTT_INTERNAL */
namespace entt::stl {
#ifndef ENTT_FORCE_STL
# if __has_include(<version>)
# include <version>
@@ -13,7 +11,13 @@ namespace entt::stl {
# if defined(__cpp_lib_ranges)
# define ENTT_HAS_IDENTITY
# include <functional>
namespace entt::stl {
using std::identity;
} // namespace entt::stl
# endif
# endif
#endif
@@ -21,6 +25,8 @@ using std::identity;
#ifndef ENTT_HAS_IDENTITY
# include <utility>
namespace entt::stl {
struct identity {
using is_transparent = void;
@@ -29,9 +35,10 @@ struct identity {
return std::forward<Type>(value);
}
};
#endif
} // namespace entt::stl
#endif
/*! @endcond */
#endif

View File

@@ -4,8 +4,6 @@
#include "../config/config.h"
/*! @cond ENTT_INTERNAL */
namespace entt::stl {
#ifndef ENTT_FORCE_STL
# if __has_include(<version>)
# include <version>
@@ -13,6 +11,9 @@ namespace entt::stl {
# if defined(__cpp_lib_ranges)
# define ENTT_HAS_ITERATOR_CONCEPTS
# include <iterator>
namespace entt::stl {
using std::bidirectional_iterator;
using std::forward_iterator;
using std::input_iterator;
@@ -20,6 +21,9 @@ using std::input_or_output_iterator;
using std::output_iterator;
using std::random_access_iterator;
using std::sentinel_for;
} // namespace entt::stl
# endif
# endif
#endif
@@ -29,6 +33,8 @@ using std::sentinel_for;
# include <iterator>
# include <utility>
namespace entt::stl {
namespace internal {
template<typename It>
@@ -87,9 +93,10 @@ template<class Sentinel, typename It>
concept sentinel_for = input_or_output_iterator<It> && requires(Sentinel sentinel, It it) {
{ it == sentinel } -> std::same_as<bool>;
};
#endif
} // namespace entt::stl
#endif
/*! @endcond */
#endif

View File

@@ -4,8 +4,6 @@
#include "../config/config.h"
/*! @cond ENTT_INTERNAL */
namespace entt::stl {
#ifndef ENTT_FORCE_STL
# if __has_include(<version>)
# include <version>
@@ -13,7 +11,13 @@ namespace entt::stl {
# if defined(__cpp_lib_to_address)
# define ENTT_HAS_TO_ADDRESS
# include <memory>
namespace entt::stl {
using std::to_address;
} // namespace entt::stl
# endif
# endif
#endif
@@ -22,6 +26,8 @@ using std::to_address;
# include <memory>
# include <type_traits>
namespace entt::stl {
template<typename Type>
constexpr Type *to_address(Type *ptr) noexcept {
static_assert(!std::is_function_v<Type>, "Invalid type");
@@ -36,9 +42,10 @@ constexpr auto to_address(const Type &ptr) noexcept {
return to_address(ptr.operator->());
}
}
#endif
/*! @endcond */
} // namespace entt::stl
#endif
/*! @endcond */
#endif