From ba2a2ff5e8c47f7403d262358d7df3c7f54d5977 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Fri, 13 Oct 2017 13:44:03 +0000 Subject: [PATCH] Remove RemoveIterator because its dangerous --- include/util/deallocating_vector.hpp | 61 ---------------------------- 1 file changed, 61 deletions(-) diff --git a/include/util/deallocating_vector.hpp b/include/util/deallocating_vector.hpp index 3d8c49488..5f3321142 100644 --- a/include/util/deallocating_vector.hpp +++ b/include/util/deallocating_vector.hpp @@ -183,57 +183,6 @@ class DeallocatingVectorIterator } }; -template -class DeallocatingVectorRemoveIterator - : public boost::iterator_facade, - ElementT, - boost::forward_traversal_tag> -{ - DeallocatingVectorIteratorState current_state; - - public: - DeallocatingVectorRemoveIterator(std::size_t idx, std::vector *input_list) - : current_state(idx, input_list) - { - } - - friend class boost::iterator_core_access; - - void increment() - { - const std::size_t old_bucket = current_state.index / ELEMENTS_PER_BLOCK; - - ++current_state.index; - const std::size_t new_bucket = current_state.index / ELEMENTS_PER_BLOCK; - if (old_bucket != new_bucket) - { - // delete old bucket entry - if (nullptr != current_state.bucket_list->at(old_bucket)) - { - delete[] current_state.bucket_list->at(old_bucket); - current_state.bucket_list->at(old_bucket) = nullptr; - } - } - } - - bool equal(DeallocatingVectorRemoveIterator const &other) const - { - return current_state.index == other.current_state.index; - } - - std::ptrdiff_t distance_to(DeallocatingVectorRemoveIterator const &other) const - { - return other.current_state.index - current_state.index; - } - - ElementT &dereference() const - { - const std::size_t current_bucket = current_state.index / ELEMENTS_PER_BLOCK; - const std::size_t current_index = current_state.index % ELEMENTS_PER_BLOCK; - return (current_state.bucket_list->at(current_bucket)[current_index]); - } -}; - template void swap(DeallocatingVector &lhs, DeallocatingVector &rhs); template class DeallocatingVector @@ -247,9 +196,6 @@ template class DeallocatingVector using iterator = DeallocatingVectorIterator; using const_iterator = ConstDeallocatingVectorIterator; - // this forward-only iterator deallocates all buckets that have been visited - using deallocation_iterator = DeallocatingVectorRemoveIterator; - DeallocatingVector() : current_size(0) { bucket_list.emplace_back(new ElementT[ELEMENTS_PER_BLOCK]); @@ -368,13 +314,6 @@ template class DeallocatingVector iterator end() { return iterator(size(), &bucket_list); } - deallocation_iterator dbegin() - { - return deallocation_iterator(static_cast(0), &bucket_list); - } - - deallocation_iterator dend() { return deallocation_iterator(size(), &bucket_list); } - const_iterator begin() const { return const_iterator(static_cast(0), &bucket_list);