sparse_set: review ::push

This commit is contained in:
Michele Caini
2024-03-25 11:19:07 +01:00
parent a8a86ba090
commit 0128620803

View File

@@ -804,15 +804,18 @@ public:
* @tparam It Type of input iterator.
* @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.
* @return Iterator pointing to the first element inserted, if any.
* @return Iterator pointing to the first element inserted in case of
* success, the `end()` iterator otherwise.
*/
template<typename It>
iterator push(It first, It last) {
for(auto it = first; it != last; ++it) {
try_emplace(*it, true);
auto curr = end();
for(; first != last; ++first) {
curr = try_emplace(*first, true);
}
return first == last ? end() : begin(0);
return curr;
}
/**