|
|
@@ -4,6 +4,7 @@
|
|
|
#include <algorithm>
|
|
|
#include <array>
|
|
|
#include <compare>
|
|
|
+#include <concepts>
|
|
|
#include <cstddef>
|
|
|
#include <functional>
|
|
|
#include <iterator>
|
|
|
@@ -485,11 +486,11 @@ public:
|
|
|
*
|
|
|
* @sa create
|
|
|
*
|
|
|
- * @tparam It Type of forward iterator.
|
|
|
+ * @tparam It Type of output iterator.
|
|
|
* @param first An iterator to the first element of the range to generate.
|
|
|
* @param last An iterator past the last element of the range to generate.
|
|
|
*/
|
|
|
- template<typename It>
|
|
|
+ template<std::output_iterator<entity_type> It>
|
|
|
void create(It first, It last) {
|
|
|
entities.generate(std::move(first), std::move(last));
|
|
|
}
|
|
|
@@ -540,7 +541,7 @@ public:
|
|
|
* @param first An iterator to the first element of the range of entities.
|
|
|
* @param last An iterator past the last element of the range of entities.
|
|
|
*/
|
|
|
- template<typename It>
|
|
|
+ template<std::input_iterator It>
|
|
|
void destroy(It first, It last) {
|
|
|
const auto to = entities.sort_as(first, last);
|
|
|
const auto from = entities.cend() - static_cast<common_type::difference_type>(entities.free_list());
|
|
|
@@ -583,7 +584,7 @@ public:
|
|
|
* @param first An iterator to the first element of the range of entities.
|
|
|
* @param last An iterator past the last element of the range of entities.
|
|
|
*/
|
|
|
- template<typename Type, typename It>
|
|
|
+ template<typename Type, std::input_iterator It>
|
|
|
void insert(It first, It last) {
|
|
|
ENTT_ASSERT(std::all_of(first, last, [this](const auto entt) { return valid(entt); }), "Invalid entity");
|
|
|
assure<Type>().insert(std::move(first), std::move(last));
|
|
|
@@ -600,7 +601,7 @@ public:
|
|
|
* @param last An iterator past the last element of the range of entities.
|
|
|
* @param value An instance of the element to assign.
|
|
|
*/
|
|
|
- template<typename Type, typename It>
|
|
|
+ template<typename Type, std::input_iterator It>
|
|
|
void insert(It first, It last, const Type &value) {
|
|
|
ENTT_ASSERT(std::all_of(first, last, [this](const auto entt) { return valid(entt); }), "Invalid entity");
|
|
|
assure<Type>().insert(std::move(first), std::move(last), value);
|
|
|
@@ -711,7 +712,7 @@ public:
|
|
|
* @param last An iterator past the last element of the range of entities.
|
|
|
* @return The number of elements actually removed.
|
|
|
*/
|
|
|
- template<typename Type, typename... Other, typename It>
|
|
|
+ template<typename Type, typename... Other, std::input_iterator It>
|
|
|
size_type remove(It first, It last) {
|
|
|
size_type count{};
|
|
|
|
|
|
@@ -764,7 +765,7 @@ public:
|
|
|
* @param first An iterator to the first element of the range of entities.
|
|
|
* @param last An iterator past the last element of the range of entities.
|
|
|
*/
|
|
|
- template<typename Type, typename... Other, typename It>
|
|
|
+ template<typename Type, typename... Other, std::input_iterator It>
|
|
|
void erase(It first, It last) {
|
|
|
if constexpr(std::is_same_v<It, typename common_type::iterator>) {
|
|
|
std::array cpools{static_cast<common_type *>(&assure<Type>()), static_cast<common_type *>(&assure<Other>())...};
|