Merge pull request #37626 from tchaikov/wip-drop-std-iterator

include/interval_set: do not inherit from std::iterator

Reviewed-by: Willem Jan Withagen <wjw@digiware.nl>
This commit is contained in:
Kefu Chai 2020-10-14 16:04:14 +08:00 committed by GitHub
commit b0b3e32d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,9 +113,15 @@ class interval_set {
friend class interval_set;
};
class const_iterator : public std::iterator <std::forward_iterator_tag, T>
class const_iterator
{
public:
using difference_type = ssize_t;
using value_type = const typename Map::value_type;
using pointer = const typename Map::value_type*;
using reference = const typename Map::value_type&;
using iterator_category = std::forward_iterator_tag;
explicit const_iterator(typename Map::const_iterator iter)
: _iter(iter)
{ }
@ -136,7 +142,7 @@ class interval_set {
}
// Dereference this iterator to get a pair.
const_reference operator*() const {
reference operator*() const {
return *_iter;
}