From c67a1b72f18fef1ffd7b3aa3fd3eb623f2139f7c Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 6 Oct 2015 17:02:42 +0200 Subject: [PATCH] unify relation operators --- alib2data/src/common/wrapper.hpp | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/alib2data/src/common/wrapper.hpp b/alib2data/src/common/wrapper.hpp index f4de62a881..fc2b25d6da 100644 --- a/alib2data/src/common/wrapper.hpp +++ b/alib2data/src/common/wrapper.hpp @@ -52,39 +52,27 @@ public: } bool operator >=( const wrapper & other ) const { - if ( this->data.get ( ) == other.data.get ( ) ) return true; - - return * ( this->data ) >= * ( other.data ); + return this->compare(other) >= 0; } bool operator <=( const wrapper & other ) const { - if ( this->data.get ( ) == other.data.get ( ) ) return true; - - return * ( this->data ) <= * ( other.data ); + return this->compare(other) <= 0; } bool operator >( const wrapper & other ) const { - if ( this->data.get ( ) == other.data.get ( ) ) return false; - - return * ( this->data ) > * ( other.data ); + return this->compare(other) > 0; } bool operator <( const wrapper & other ) const { - if ( this->data.get ( ) == other.data.get ( ) ) return false; - - return * ( this->data ) < * ( other.data ); + return this->compare(other) < 0; } bool operator !=( const wrapper & other ) const { - if ( this->data.get ( ) == other.data.get ( ) ) return false; - - return * ( this->data ) != * ( other.data ); + return this->compare(other) != 0; } bool operator ==( const wrapper & other ) const { - if ( this->data.get ( ) == other.data.get ( ) ) return true; - - return * ( this->data ) == * ( other.data ); + return this->compare(other) == 0; } int compare ( const wrapper & other ) const { -- GitLab