Commit 1d2a94c3 authored by Mark Olesen's avatar Mark Olesen
Browse files

HashTable minor iterator issues

- made const_iterator::operator* and const_iterator::operator() const only
- added const versions of iterator::operator* and iterator::operator()
parent a0a9cd33
......@@ -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);
......
......@@ -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
......
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