Fix comparison function signature
Summary:
This commit fixes build on CentOS 7 with GCC 4.8.5
Also for std::swap() header <algorithm> is replaced with <utility> one.
This is a backport of Core PR17364 [1/2]
https://github.com/bitcoin/bitcoin/pull/17634/commits/b66861e2e5e8a49e11e7489cf22c3007bc7082cc
Test Plan: ninja
Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D8281