Last active
September 18, 2018 18:00
-
-
Save carmel4a/dd3e4b13f20301c0195a82bf90280640 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct A | |
{ | |
int m; | |
int cm; | |
int mm; | |
chujowy_vector v; | |
}; | |
// Check if first element `t` is less than `r` | |
template< class T > | |
static bool is_less( T t, T r ) | |
{ | |
return t < r; | |
} | |
template<> | |
static bool is_less( chujowy_vector t, chujowy_vector r ) | |
{ | |
for( auto x = 0; x < t.size(); ++x ) | |
if ( t[x] >= r[x] ) return false; | |
return true; | |
} | |
bool A::operator<( const &A rhs ) | |
{ | |
if( is_less( m, rhs.m ) ) return true; | |
if( is_less( cm, rhs.cm ) ) return true; | |
... | |
if( is_less( v, rhs.v ) ) return true; | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment