diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h index 5a3c4edee66..e5b4396f24b 100644 --- a/src/libs/utils/algorithm.h +++ b/src/libs/utils/algorithm.h @@ -566,52 +566,56 @@ namespace { // SetInsertIterator, straight from the standard for insert_iterator // just without the additional parameter to insert -template - class SetInsertIterator : - public std::iterator +template +class SetInsertIterator { protected: Container *container; public: - using container_type = Container; - explicit SetInsertIterator (Container &x) - : container(&x) {} - SetInsertIterator &operator=(const typename Container::value_type &value) - { container->insert(value); return *this; } - SetInsertIterator &operator= (typename Container::value_type &&value) - { container->insert(std::move(value)); return *this; } - SetInsertIterator&operator*() - { return *this; } - SetInsertIterator &operator++() - { return *this; } - SetInsertIterator operator++(int) - { return *this; } + using iterator_category = std::output_iterator_tag; + using container_type = Container; + explicit SetInsertIterator(Container &x) + : container(&x) + {} + SetInsertIterator &operator=(const typename Container::value_type &value) + { + container->insert(value); + return *this; + } + SetInsertIterator &operator=(typename Container::value_type &&value) + { + container->insert(std::move(value)); + return *this; + } + SetInsertIterator &operator*() { return *this; } + SetInsertIterator &operator++() { return *this; } + SetInsertIterator operator++(int) { return *this; } }; // for QMap / QHash, inserting a std::pair / QPair -template - class MapInsertIterator : - public std::iterator - { - protected: +template +class MapInsertIterator +{ +protected: Container *container; - public: +public: + using iterator_category = std::output_iterator_tag; using container_type = Container; - explicit MapInsertIterator (Container &x) - : container(&x) {} - MapInsertIterator &operator=(const std::pair &value) - { container->insert(value.first, value.second); return *this; } - MapInsertIterator &operator=(const QPair &value) - { container->insert(value.first, value.second); return *this; } - MapInsertIterator&operator*() - { return *this; } - MapInsertIterator &operator++() - { return *this; } - MapInsertIterator operator++(int) - { return *this; } - }; + explicit MapInsertIterator(Container &x) + : container(&x) + {} + MapInsertIterator &operator=( + const std::pair &value) + { container->insert(value.first, value.second); return *this; } + MapInsertIterator &operator=( + const QPair &value) + { container->insert(value.first, value.second); return *this; } + MapInsertIterator &operator*() { return *this; } + MapInsertIterator &operator++() { return *this; } + MapInsertIterator operator++(int) { return *this; } +}; // inserter helper function, returns a std::back_inserter for most containers // and is overloaded for QSet<> and other containers without push_back, returning custom inserters