Skip to content
Snippets Groups Projects
Commit d99b8a3f authored by Markus Blatt's avatar Markus Blatt
Browse files

Added comparison operators

[[Imported from SVN: r5412]]
parent 800842ae
No related branches found
No related tags found
No related merge requests found
......@@ -192,6 +192,11 @@ namespace Dune
*/
inline int size() const;
bool operator==(const SLList& sl) const;
bool operator!=(const SLList& sl) const;
private:
/** \todo Please doc me! */
struct Element
......@@ -610,6 +615,30 @@ namespace Dune
clear();
}
template<typename T, class A>
bool SLList<T,A>::operator==(const SLList& other) const
{
if(size!=other.size())
return false;
for(const_iterator iter=begin(), oiter=other.begin();
iter != end(); ++iter, ++oiter)
if(*iter!=*oiter)
return false;
return true;
}
template<typename T, class A>
bool SLList<T,A>::operator!=(const SLList& other) const
{
if(size()==other.size()) {
for(const_iterator iter=begin(), oiter=other.begin();
iter != end(); ++iter, ++oiter)
if(*iter!=*oiter)
return true;
return false;
}else
return true;
}
template<typename T, class A>
SLList<T,A>& SLList<T,A>::operator=(const SLList<T,A>& other)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment