HashTable minor iterator issues

- made const_iterator::operator* and const_iterator::operator() const only
- added const versions of iterator::operator* and iterator::operator()
This commit is contained in:
Mark Olesen
2009-05-19 13:14:54 +02:00
parent a0a9cd3366
commit 1d2a94c38b
2 changed files with 31 additions and 8 deletions

View File

@ -330,6 +330,9 @@ public:
inline T& operator*();
inline T& operator()();
inline const T& operator*() const;
inline const T& operator()() const;
inline iterator& operator++();
inline iterator operator++(int);
@ -389,8 +392,8 @@ public:
inline bool operator==(const iterator&) const;
inline bool operator!=(const iterator&) const;
inline const T& operator*();
inline const T& operator()();
inline const T& operator*() const;
inline const T& operator()() const;
inline const_iterator& operator++();
inline const_iterator operator++(int);

View File

@ -220,16 +220,34 @@ inline bool Foam::HashTable<T, Key, Hash>::iterator::operator!=
template<class T, class Key, class Hash>
inline T& Foam::HashTable<T, Key, Hash>::iterator::operator*()
inline T&
Foam::HashTable<T, Key, Hash>::iterator::operator*()
{
return elmtPtr_->obj_;
}
template<class T, class Key, class Hash>
inline T& Foam::HashTable<T, Key, Hash>::iterator::operator()()
inline T&
Foam::HashTable<T, Key, Hash>::iterator::operator()()
{
return operator*();
return elmtPtr_->obj_;
}
template<class T, class Key, class Hash>
inline const T&
Foam::HashTable<T, Key, Hash>::iterator::operator*() const
{
return elmtPtr_->obj_;
}
template<class T, class Key, class Hash>
inline const T&
Foam::HashTable<T, Key, Hash>::iterator::operator()() const
{
return elmtPtr_->obj_;
}
@ -410,16 +428,18 @@ inline bool Foam::HashTable<T, Key, Hash>::const_iterator::operator!=
template<class T, class Key, class Hash>
inline const T& Foam::HashTable<T, Key, Hash>::const_iterator::operator*()
inline const T&
Foam::HashTable<T, Key, Hash>::const_iterator::operator*() const
{
return elmtPtr_->obj_;
}
#ifndef __CINT__
template<class T, class Key, class Hash>
inline const T& Foam::HashTable<T, Key, Hash>::const_iterator::operator()()
inline const T&
Foam::HashTable<T, Key, Hash>::const_iterator::operator()() const
{
return operator*();
return elmtPtr_->obj_;
}
#endif