From 9b64f3fe96585383dabab02bad2004f02a24534c Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 20 Dec 2016 12:07:12 +0100 Subject: [PATCH] fix compare of container classes ( add missing & ) --- alib2common/src/container/ObjectsDeque.h | 4 ++-- alib2common/src/container/ObjectsList.h | 4 ++-- alib2common/src/container/ObjectsMap.h | 4 ++-- alib2common/src/container/ObjectsPair.h | 4 ++-- alib2common/src/container/ObjectsSet.h | 4 ++-- alib2common/src/container/ObjectsTree.h | 4 ++-- alib2common/src/container/ObjectsVector.h | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/alib2common/src/container/ObjectsDeque.h b/alib2common/src/container/ObjectsDeque.h index 21282ec7d9..2eca9e9fac 100644 --- a/alib2common/src/container/ObjectsDeque.h +++ b/alib2common/src/container/ObjectsDeque.h @@ -83,12 +83,12 @@ template < class ElementType > int ObjectsDeque < ElementType >::compare ( const ObjectsDeque & other ) const { std::compare < std::deque < ElementType > > comp; - return comp ( static_cast < const std::deque < ElementType > > ( * this ), static_cast < const std::deque < ElementType > > ( other ) ); + return comp ( static_cast < const std::deque < ElementType > & > ( * this ), static_cast < const std::deque < ElementType > & > ( other ) ); } template < class ElementType > void ObjectsDeque < ElementType >::operator >>( std::ostream & os ) const { - os << "(ObjectsDeque " << static_cast < const std::deque < ElementType > > ( * this ) << ")"; + os << "(ObjectsDeque " << static_cast < const std::deque < ElementType > & > ( * this ) << ")"; } template < class ElementType > diff --git a/alib2common/src/container/ObjectsList.h b/alib2common/src/container/ObjectsList.h index 2cc8d3f47e..fc42141fcf 100644 --- a/alib2common/src/container/ObjectsList.h +++ b/alib2common/src/container/ObjectsList.h @@ -83,12 +83,12 @@ template < class ElementType > int ObjectsList < ElementType >::compare ( const ObjectsList & other ) const { std::compare < std::list < ElementType > > comp; - return comp ( static_cast < const std::list < ElementType > > ( * this ), static_cast < const std::list < ElementType > > ( other ) ); + return comp ( static_cast < const std::list < ElementType > & > ( * this ), static_cast < const std::list < ElementType > & > ( other ) ); } template < class ElementType > void ObjectsList < ElementType >::operator >>( std::ostream & os ) const { - os << "(ObjectsList " << static_cast < const std::list < ElementType > > ( * this ) << ")"; + os << "(ObjectsList " << static_cast < const std::list < ElementType > & > ( * this ) << ")"; } template < class ElementType > diff --git a/alib2common/src/container/ObjectsMap.h b/alib2common/src/container/ObjectsMap.h index c65ae1c4c0..bd4b7da321 100644 --- a/alib2common/src/container/ObjectsMap.h +++ b/alib2common/src/container/ObjectsMap.h @@ -86,12 +86,12 @@ ContainerBase* ObjectsMap<KeyType, ValueType>::plunder() && { template < class KeyType, class ValueType > int ObjectsMap<KeyType, ValueType>::compare(const ObjectsMap& other) const { std::compare<std::map<KeyType, ValueType>> comp; - return comp(static_cast<const std::map<KeyType, ValueType>>(*this), static_cast<const std::map<KeyType, ValueType>>(other)); + return comp ( static_cast < const std::map < KeyType, ValueType > & > ( * this ), static_cast < const std::map < KeyType, ValueType > & > ( other ) ); } template < class KeyType, class ValueType > void ObjectsMap<KeyType, ValueType>::operator>>(std::ostream& os) const { - os << "(ObjectsMap " << static_cast<const std::map<KeyType, ValueType>>(*this) << ")"; + os << "(ObjectsMap " << static_cast < const std::map < KeyType, ValueType > & > ( * this ) << ")"; } template < class KeyType, class ValueType > diff --git a/alib2common/src/container/ObjectsPair.h b/alib2common/src/container/ObjectsPair.h index df35115e50..bf1147d2e5 100644 --- a/alib2common/src/container/ObjectsPair.h +++ b/alib2common/src/container/ObjectsPair.h @@ -84,12 +84,12 @@ ContainerBase* ObjectsPair < FirstType, SecondType >::plunder() && { template < class FirstType, class SecondType > int ObjectsPair < FirstType, SecondType >::compare(const ObjectsPair& other) const { std::compare<std::pair<FirstType, SecondType>> comp; - return comp(static_cast<const std::pair<FirstType, SecondType>>(*this), static_cast<const std::pair<FirstType, SecondType>>(other)); + return comp ( static_cast < const std::pair < FirstType, SecondType > & > ( * this ), static_cast < const std::pair < FirstType, SecondType > & > ( other ) ); } template < class FirstType, class SecondType > void ObjectsPair < FirstType, SecondType >::operator>>(std::ostream& os) const { - os << "(ObjectsPair " << static_cast<const std::pair<FirstType, SecondType>>(*this) << ")"; + os << "(ObjectsPair " << static_cast < const std::pair < FirstType, SecondType > & > ( * this ) << ")"; } template < class FirstType, class SecondType > diff --git a/alib2common/src/container/ObjectsSet.h b/alib2common/src/container/ObjectsSet.h index 8a91eb6cef..7c3bbcbf74 100644 --- a/alib2common/src/container/ObjectsSet.h +++ b/alib2common/src/container/ObjectsSet.h @@ -84,12 +84,12 @@ ContainerBase* ObjectsSet < ElementType >::plunder() && { template < class ElementType > int ObjectsSet < ElementType >::compare(const ObjectsSet& other) const { std::compare<std::set<ElementType>> comp; - return comp(static_cast<const std::set<ElementType>>(*this), static_cast<const std::set<ElementType>>(other)); + return comp ( static_cast < const std::set < ElementType > & > ( * this ), static_cast < const std::set < ElementType > & > ( other ) ); } template < class ElementType > void ObjectsSet < ElementType >::operator>>(std::ostream& os) const { - os << "(ObjectsSet " << static_cast<const std::set<ElementType>>(*this) << ")"; + os << "(ObjectsSet " << static_cast < const std::set < ElementType > & > ( * this ) << ")"; } template < class ElementType > diff --git a/alib2common/src/container/ObjectsTree.h b/alib2common/src/container/ObjectsTree.h index a520ec9090..3924bb08fd 100644 --- a/alib2common/src/container/ObjectsTree.h +++ b/alib2common/src/container/ObjectsTree.h @@ -78,12 +78,12 @@ template < class ElementType > int ObjectsTree < ElementType >::compare ( const ObjectsTree & other ) const { std::compare < std::tree < ElementType > > comp; - return comp ( static_cast < const std::tree < ElementType > > ( * this ), static_cast < const std::tree < ElementType > > ( other ) ); + return comp ( static_cast < const std::tree < ElementType > & > ( * this ), static_cast < const std::tree < ElementType > & > ( other ) ); } template < class ElementType > void ObjectsTree < ElementType >::operator >>( std::ostream & os ) const { - os << "(ObjectsTree " << static_cast < const std::tree < ElementType > > ( * this ) << ")"; + os << "(ObjectsTree " << static_cast < const std::tree < ElementType > & > ( * this ) << ")"; } template < class ElementType > diff --git a/alib2common/src/container/ObjectsVector.h b/alib2common/src/container/ObjectsVector.h index 514343d010..b46844f94a 100644 --- a/alib2common/src/container/ObjectsVector.h +++ b/alib2common/src/container/ObjectsVector.h @@ -83,12 +83,12 @@ template < class ElementType > int ObjectsVector < ElementType >::compare ( const ObjectsVector & other ) const { std::compare < std::vector < ElementType > > comp; - return comp ( static_cast < const std::vector < ElementType > > ( * this ), static_cast < const std::vector < ElementType > > ( other ) ); + return comp ( static_cast < const std::vector < ElementType > & > ( * this ), static_cast < const std::vector < ElementType > & > ( other ) ); } template < class ElementType > void ObjectsVector < ElementType >::operator >>( std::ostream & os ) const { - os << "(ObjectsVector " << static_cast < const std::vector < ElementType > > ( * this ) << ")"; + os << "(ObjectsVector " << static_cast < const std::vector < ElementType > & > ( * this ) << ")"; } template < class ElementType > -- GitLab