code refactoring with std::cmp::Ordering
4 files changed