From 243a382485b32bcce399344f8d352ad2cec8fdc5 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 1 Jul 2022 18:09:16 +0200 Subject: [PATCH] registry: drop some lambdas and calls to std:: --- src/entt/entity/registry.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index de965c12b..577b0f14a 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -765,7 +765,7 @@ public: */ template void insert(It first, It last, const Type &value = {}) { - ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return valid(entity); }), "Invalid entity"); + ENTT_ASSERT(([this, it = first, &last]() mutable { for(; it != last && valid(*it); ++it); return it; }() == last), "Invalid entity"); assure().insert(first, last, value); } @@ -783,7 +783,7 @@ public: */ template::value_type, Type>>> void insert(EIt first, EIt last, CIt from) { - ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return valid(entity); }), "Invalid entity"); + ENTT_ASSERT(([this, it = first, &last]() mutable { for(; it != last && valid(*it); ++it); return it; }() == last), "Invalid entity"); assure().insert(first, last, from); } @@ -891,7 +891,7 @@ public: template size_type remove(It first, It last) { if constexpr(sizeof...(Other) == 0u) { - ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return valid(entity); }), "Invalid entity"); + ENTT_ASSERT(([this, it = first, &last]() mutable { for(; it != last && valid(*it); ++it); return it; }() == last), "Invalid entity"); return assure().remove(std::move(first), std::move(last)); } else { size_type count{}; @@ -936,7 +936,7 @@ public: template void erase(It first, It last) { if constexpr(sizeof...(Other) == 0u) { - ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return valid(entity); }), "Invalid entity"); + ENTT_ASSERT(([this, it = first, &last]() mutable { for(; it != last && valid(*it); ++it); return it; }() == last), "Invalid entity"); assure().erase(std::move(first), std::move(last)); } else { for(auto cpools = std::forward_as_tuple(assure(), assure()...); first != last; ++first) {