stl: std::same_as
This commit is contained in:
@@ -79,7 +79,7 @@ public:
|
||||
: it{iter} {}
|
||||
|
||||
template<typename Other>
|
||||
requires (!std::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
requires (!stl::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
constexpr dense_map_iterator(const dense_map_iterator<Other> &other) noexcept
|
||||
: it{other.it} {}
|
||||
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
offset{pos} {}
|
||||
|
||||
template<typename Other>
|
||||
requires (!std::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
requires (!stl::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
constexpr dense_map_local_iterator(const dense_map_local_iterator<Other> &other) noexcept
|
||||
: it{other.it},
|
||||
offset{other.offset} {}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
: it{iter} {}
|
||||
|
||||
template<typename Other>
|
||||
requires (!std::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
requires (!stl::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
constexpr dense_set_iterator(const dense_set_iterator<Other> &other) noexcept
|
||||
: it{other.it} {}
|
||||
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
offset{pos} {}
|
||||
|
||||
template<typename Other>
|
||||
requires (!std::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
requires (!stl::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
constexpr dense_set_local_iterator(const dense_set_local_iterator<Other> &other) noexcept
|
||||
: it{other.it},
|
||||
offset{other.offset} {}
|
||||
|
||||
@@ -225,7 +225,7 @@ public:
|
||||
* @param value An instance of an object to use to initialize the wrapper.
|
||||
*/
|
||||
template<typename Type>
|
||||
requires (!std::same_as<stl::remove_cvref_t<Type>, basic_any>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Type>, basic_any>)
|
||||
basic_any(Type &&value)
|
||||
: basic_any{stl::in_place_type<stl::decay_t<Type>>, stl::forward<Type>(value)} {}
|
||||
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
* @return This any object.
|
||||
*/
|
||||
template<typename Type>
|
||||
requires (!std::same_as<stl::remove_cvref_t<Type>, basic_any>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Type>, basic_any>)
|
||||
basic_any &operator=(Type &&value) {
|
||||
emplace<stl::decay_t<Type>>(stl::forward<Type>(value));
|
||||
return *this;
|
||||
|
||||
@@ -25,7 +25,7 @@ struct compressed_pair_element {
|
||||
|
||||
template<typename Arg>
|
||||
constexpr compressed_pair_element(Arg &&arg) noexcept(stl::is_nothrow_constructible_v<Type, Arg>)
|
||||
requires (!std::same_as<stl::remove_cvref_t<Arg>, compressed_pair_element>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Arg>, compressed_pair_element>)
|
||||
: value{stl::forward<Arg>(arg)} {}
|
||||
|
||||
template<typename... Args, stl::size_t... Index>
|
||||
@@ -57,7 +57,7 @@ struct compressed_pair_element<Type, Tag>: Type {
|
||||
|
||||
template<typename Arg>
|
||||
constexpr compressed_pair_element(Arg &&arg) noexcept(stl::is_nothrow_constructible_v<base_type, Arg>)
|
||||
requires (!std::same_as<stl::remove_cvref_t<Arg>, compressed_pair_element>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Arg>, compressed_pair_element>)
|
||||
: base_type{stl::forward<Arg>(arg)} {}
|
||||
|
||||
template<typename... Args, stl::size_t... Index>
|
||||
|
||||
@@ -17,7 +17,7 @@ struct enum_as_bitmask: stl::false_type {};
|
||||
template<typename Type>
|
||||
requires requires {
|
||||
requires stl::is_enum_v<Type>;
|
||||
{ Type::_entt_enum_as_bitmask } -> std::same_as<Type>;
|
||||
{ Type::_entt_enum_as_bitmask } -> stl::same_as<Type>;
|
||||
}
|
||||
struct enum_as_bitmask<Type>: stl::true_type {};
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
: it{iter} {}
|
||||
|
||||
template<typename Other>
|
||||
requires (!std::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
requires (!stl::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
constexpr registry_storage_iterator(const registry_storage_iterator<Other> &other) noexcept
|
||||
: registry_storage_iterator{other.it} {}
|
||||
|
||||
@@ -597,7 +597,7 @@ public:
|
||||
* @param from An iterator to the first element of the range of elements.
|
||||
*/
|
||||
template<typename Type, typename EIt, typename CIt>
|
||||
requires std::same_as<typename stl::iterator_traits<CIt>::value_type, Type>
|
||||
requires stl::same_as<typename stl::iterator_traits<CIt>::value_type, Type>
|
||||
void insert(EIt first, EIt last, CIt from) {
|
||||
ENTT_ASSERT(std::all_of(first, last, [this](const auto entt) { return valid(entt); }), "Invalid entity");
|
||||
assure<Type>().insert(first, last, from);
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
: payload{ref},
|
||||
offset{idx} {}
|
||||
|
||||
template<std::same_as<stl::remove_const_t<Container>> Other>
|
||||
template<stl::same_as<stl::remove_const_t<Container>> Other>
|
||||
requires stl::is_const_v<Container>
|
||||
constexpr storage_iterator(const storage_iterator<Other, Page> &other) noexcept
|
||||
: storage_iterator{other.payload, other.offset} {}
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
: it{base, other...} {}
|
||||
|
||||
template<typename... Args>
|
||||
requires (!std::same_as<Other, Args> && ...) && (std::constructible_from<Other, Args> && ...)
|
||||
requires (!stl::same_as<Other, Args> && ...) && (std::constructible_from<Other, Args> && ...)
|
||||
constexpr extended_storage_iterator(const extended_storage_iterator<It, Args...> &other)
|
||||
: it{other.it} {}
|
||||
|
||||
@@ -724,7 +724,7 @@ public:
|
||||
* @return Iterator pointing to the first element inserted, if any.
|
||||
*/
|
||||
template<stl::input_iterator It>
|
||||
requires std::same_as<typename stl::iterator_traits<It>::value_type, value_type>
|
||||
requires stl::same_as<typename stl::iterator_traits<It>::value_type, value_type>
|
||||
iterator insert(stl::input_iterator auto first, stl::input_iterator auto last, It from) {
|
||||
for(; first != last; ++first, ++from) {
|
||||
emplace_element(*first, true, *from);
|
||||
|
||||
@@ -487,7 +487,7 @@ public:
|
||||
* @param other A view to convert from.
|
||||
*/
|
||||
template<typename... Args>
|
||||
requires (!std::same_as<basic_view, basic_view<Args...>>)
|
||||
requires (!stl::same_as<basic_view, basic_view<Args...>>)
|
||||
basic_view(const basic_view<Args...> &other) noexcept
|
||||
: basic_view{} {
|
||||
(storage_if(other.template storage<typename Get::element_type>()), ...);
|
||||
@@ -945,7 +945,7 @@ public:
|
||||
* @param other A view to convert from.
|
||||
*/
|
||||
template<typename... Args>
|
||||
requires (!std::same_as<basic_view, basic_view<Args...>>)
|
||||
requires (!stl::same_as<basic_view, basic_view<Args...>>)
|
||||
basic_view(const basic_view<Args...> &other) noexcept
|
||||
: base_type{} {
|
||||
storage_if(other.template storage<typename Get::element_type>());
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace entt {
|
||||
template<typename Graph>
|
||||
requires std::derived_from<typename Graph::graph_category, directed_tag>
|
||||
void dot(std::ostream &out, const Graph &graph, std::invocable<std::ostream &, typename Graph::vertex_type> auto writer) {
|
||||
if constexpr(std::same_as<typename Graph::graph_category, undirected_tag>) {
|
||||
if constexpr(stl::same_as<typename Graph::graph_category, undirected_tag>) {
|
||||
out << "graph{";
|
||||
} else {
|
||||
out << "digraph{";
|
||||
@@ -30,7 +30,7 @@ void dot(std::ostream &out, const Graph &graph, std::invocable<std::ostream &, t
|
||||
}
|
||||
|
||||
for(auto [lhs, rhs]: graph.edges()) {
|
||||
if constexpr(std::same_as<typename Graph::graph_category, undirected_tag>) {
|
||||
if constexpr(stl::same_as<typename Graph::graph_category, undirected_tag>) {
|
||||
out << lhs << "--" << rhs << ";";
|
||||
} else {
|
||||
out << lhs << "->" << rhs << ";";
|
||||
|
||||
@@ -35,8 +35,8 @@ concept meta_sequence_container_like = requires(Type elem) {
|
||||
typename Type::value_type;
|
||||
typename Type::iterator;
|
||||
requires entt::stl::forward_iterator<typename Type::iterator>;
|
||||
{ elem.begin() } -> std::same_as<typename Type::iterator>;
|
||||
{ elem.end() } -> std::same_as<typename Type::iterator>;
|
||||
{ elem.begin() } -> stl::same_as<typename Type::iterator>;
|
||||
{ elem.end() } -> stl::same_as<typename Type::iterator>;
|
||||
requires !requires { typename Type::key_type; };
|
||||
requires !requires { elem.substr(); };
|
||||
};
|
||||
@@ -47,8 +47,8 @@ concept meta_associative_container_like = requires(Type value) {
|
||||
typename Type::value_type;
|
||||
typename Type::iterator;
|
||||
requires entt::stl::forward_iterator<typename Type::iterator>;
|
||||
{ value.begin() } -> std::same_as<typename Type::iterator>;
|
||||
{ value.end() } -> std::same_as<typename Type::iterator>;
|
||||
{ value.begin() } -> stl::same_as<typename Type::iterator>;
|
||||
{ value.end() } -> stl::same_as<typename Type::iterator>;
|
||||
value.find(stl::declval<typename Type::key_type>());
|
||||
};
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
template<typename Base>
|
||||
requires std::derived_from<Type, Base>
|
||||
meta_factory base() noexcept {
|
||||
if constexpr(!std::same_as<Type, Base>) {
|
||||
if constexpr(!stl::same_as<Type, Base>) {
|
||||
auto *const op = +[](const void *instance) noexcept { return static_cast<const void *>(static_cast<const Base *>(static_cast<const Type *>(instance))); };
|
||||
|
||||
base_type::insert_or_assign(
|
||||
|
||||
@@ -292,7 +292,7 @@ public:
|
||||
* @param value An instance of an object to use to initialize the wrapper.
|
||||
*/
|
||||
template<typename Type>
|
||||
requires (!std::same_as<stl::remove_cvref_t<Type>, meta_any>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Type>, meta_any>)
|
||||
meta_any(Type &&value)
|
||||
: meta_any{locator<meta_ctx>::value_or(), stl::forward<Type>(value)} {}
|
||||
|
||||
@@ -303,7 +303,7 @@ public:
|
||||
* @param value An instance of an object to use to initialize the wrapper.
|
||||
*/
|
||||
template<typename Type>
|
||||
requires (!std::same_as<stl::remove_cvref_t<Type>, meta_any>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Type>, meta_any>)
|
||||
meta_any(const meta_ctx &area, Type &&value)
|
||||
: meta_any{area, stl::in_place_type<stl::decay_t<Type>>, stl::forward<Type>(value)} {}
|
||||
|
||||
@@ -389,7 +389,7 @@ public:
|
||||
* @return This meta any object.
|
||||
*/
|
||||
template<typename Type>
|
||||
requires (!std::same_as<stl::remove_cvref_t<Type>, meta_any>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Type>, meta_any>)
|
||||
meta_any &operator=(Type &&value) {
|
||||
emplace<stl::decay_t<Type>>(stl::forward<Type>(value));
|
||||
return *this;
|
||||
@@ -689,7 +689,7 @@ template<typename Type>
|
||||
/*! @brief Opaque pointers to instances of any type. */
|
||||
class meta_handle {
|
||||
template<typename Type, typename... Args>
|
||||
requires std::same_as<stl::remove_cvref_t<Type>, meta_any>
|
||||
requires stl::same_as<stl::remove_cvref_t<Type>, meta_any>
|
||||
meta_handle(int, Type &value, Args &&...args)
|
||||
: any{stl::forward<Args>(args)..., value.as_ref()} {}
|
||||
|
||||
@@ -708,7 +708,7 @@ public:
|
||||
* @param value An instance of an object to use to initialize the handle.
|
||||
*/
|
||||
template<typename Type>
|
||||
requires (!std::same_as<stl::remove_cvref_t<Type>, meta_handle>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Type>, meta_handle>)
|
||||
meta_handle(const meta_ctx &ctx, Type &value)
|
||||
: meta_handle{0, value, ctx} {}
|
||||
|
||||
@@ -718,7 +718,7 @@ public:
|
||||
* @param value An instance of an object to use to initialize the handle.
|
||||
*/
|
||||
template<typename Type>
|
||||
requires (!std::same_as<stl::remove_cvref_t<Type>, meta_handle>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Type>, meta_handle>)
|
||||
meta_handle(Type &value)
|
||||
: meta_handle{0, value} {}
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ public:
|
||||
* @param value An instance of an object to use to initialize the poly.
|
||||
*/
|
||||
template<typename Type>
|
||||
requires (!std::same_as<stl::remove_cvref_t<Type>, basic_poly>)
|
||||
requires (!stl::same_as<stl::remove_cvref_t<Type>, basic_poly>)
|
||||
basic_poly(Type &&value) noexcept
|
||||
: basic_poly{stl::in_place_type<stl::remove_cvref_t<Type>>, stl::forward<Type>(value)} {}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
: it{iter} {}
|
||||
|
||||
template<typename Other>
|
||||
requires (!std::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
requires (!stl::same_as<It, Other> && std::constructible_from<It, Other>)
|
||||
constexpr resource_cache_iterator(const resource_cache_iterator<stl::remove_const_t<Type>, Other> &other) noexcept
|
||||
: it{other.it} {}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
* @param other The handle to copy from.
|
||||
*/
|
||||
template<typename Other>
|
||||
requires (!std::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
|
||||
requires (!stl::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
|
||||
resource(const resource<Other> &other) noexcept
|
||||
: value{other.value} {}
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
* @param other The handle to move from.
|
||||
*/
|
||||
template<typename Other>
|
||||
requires (!std::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
|
||||
requires (!stl::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
|
||||
resource(resource<Other> &&other) noexcept
|
||||
: value{stl::move(other.value)} {}
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
* @return This resource handle.
|
||||
*/
|
||||
template<typename Other>
|
||||
requires (!std::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
|
||||
requires (!stl::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
|
||||
resource &operator=(const resource<Other> &other) noexcept {
|
||||
value = other.value;
|
||||
return *this;
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
* @return This resource handle.
|
||||
*/
|
||||
template<typename Other>
|
||||
requires (!std::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
|
||||
requires (!stl::same_as<Type, Other> && std::constructible_from<Type &, Other &>)
|
||||
resource &operator=(resource<Other> &&other) noexcept {
|
||||
value = stl::move(other.value);
|
||||
return *this;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
/*! @cond ENTT_INTERNAL */
|
||||
namespace entt::stl {
|
||||
|
||||
using std::same_as;
|
||||
|
||||
} // namespace entt::stl
|
||||
/*! @endcond */
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ concept has_iterator_tag = std::derived_from<typename iterator_tag<It>::type, Ta
|
||||
template<typename It>
|
||||
concept input_or_output_iterator = requires(It it) {
|
||||
*it;
|
||||
{ ++it } -> std::same_as<It &>;
|
||||
{ ++it } -> stl::same_as<It &>;
|
||||
it++;
|
||||
};
|
||||
|
||||
@@ -94,7 +94,7 @@ concept random_access_iterator = bidirectional_iterator<It> && internal::has_ite
|
||||
|
||||
template<class Sentinel, typename It>
|
||||
concept sentinel_for = input_or_output_iterator<It> && requires(Sentinel sentinel, It it) {
|
||||
{ it == sentinel } -> std::same_as<bool>;
|
||||
{ it == sentinel } -> stl::same_as<bool>;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user