Commit 104259fa authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

clarify constness of const/normal iterators


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1021 e5f2f494-b856-4b98-b285-d166d9295462
parent 28682c14
......@@ -36,7 +36,7 @@ public:
isc::Exception(file, line, what) {}
};
template <typename T>
template <typename T, typename P, typename R>
class RRsetListIterator :
public std::iterator<std::input_iterator_tag, RRsetPtr> {
public:
......@@ -54,11 +54,11 @@ public:
++it_;
return (tmp);
}
RRsetPtr& operator*() const
R operator*() const
{
return (it_.operator*());
return (*it_);
}
RRsetPtr* operator->() const
P operator->() const
{
return (it_.operator->());
}
......@@ -66,6 +66,10 @@ public:
{
return (it_ == other.it_);
}
bool operator!=(const RRsetListIterator& other)
{
return (it_ != other.it_);
}
private:
T it_;
......@@ -80,9 +84,12 @@ public:
RRsetPtr operator[](RRType t) { return (this->findRRset(t)); }
typedef RRsetListIterator<std::vector<RRsetPtr>::iterator> iterator;
typedef RRsetListIterator<std::vector<RRsetPtr>::const_iterator>
const_iterator;
typedef RRsetListIterator<std::vector<RRsetPtr>::iterator,
RRsetPtr*,
RRsetPtr&> iterator;
typedef RRsetListIterator<std::vector<RRsetPtr>::const_iterator,
const RRsetPtr*,
const RRsetPtr&> const_iterator;
const_iterator begin() const { return (const_iterator(rrsets_.begin())); }
const_iterator end() const { return (const_iterator(rrsets_.end())); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment