Commit 1a31a780 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Minor improvements to ChronoEntity (!843, #60)

Closes #60
parents 875efffa e9811ee3
......@@ -86,7 +86,10 @@ public:
public:
// ==========================================================================
/// comparison operator
bool operator<( const ChronoEntity& entity ) const;
friend bool operator<( ChronoEntity const& lhs, ChronoEntity const& rhs ) {
return std::make_tuple( lhs.totalTime(), lhs.m_user, lhs.m_kernel, lhs.m_elapsed ) <
std::make_tuple( rhs.totalTime(), rhs.m_user, rhs.m_kernel, rhs.m_elapsed );
}
// ==========================================================================
/// Compound assignment operator
ChronoEntity& operator+=( const ChronoEntity& entity );
......
......@@ -134,25 +134,6 @@ std::string ChronoEntity::format( const double total, const double minimal, cons
return fmt.str();
}
// ============================================================================
// comparison operator
// ============================================================================
bool ChronoEntity::operator<( const ChronoEntity& e ) const {
return ( &e == this )
? false
: ( totalTime() < e.totalTime() )
? true
: ( totalTime() > e.totalTime() )
? false
: ( m_user < e.m_user )
? true
: ( e.m_user < m_user )
? false
: ( m_kernel < e.m_kernel )
? true
: ( e.m_kernel < m_kernel ) ? false
: ( m_elapsed < e.m_elapsed ) ? true : false;
}
// ============================================================================
// compound assignment operator
// ============================================================================
ChronoEntity& ChronoEntity::operator+=( const ChronoEntity& e ) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment