Skip to content

Instantly share code, notes, and snippets.

@carmel4a
Last active September 18, 2018 18:00
Show Gist options
  • Save carmel4a/dd3e4b13f20301c0195a82bf90280640 to your computer and use it in GitHub Desktop.
Save carmel4a/dd3e4b13f20301c0195a82bf90280640 to your computer and use it in GitHub Desktop.
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