#ifndef XRPL_BASICS_COMPARATORS_H_INCLUDED #define XRPL_BASICS_COMPARATORS_H_INCLUDED #include namespace ripple { #ifdef _MSC_VER /* * MSVC 2019 version 16.9.0 added [[nodiscard]] to the std comparison * operator() functions. boost::bimap checks that the comparitor is a * BinaryFunction, in part by calling the function and ignoring the value. * These two things don't play well together. These wrapper classes simply * strip [[nodiscard]] from operator() for use in boost::bimap. * * See also: * https://www.boost.org/doc/libs/1_75_0/libs/bimap/doc/html/boost_bimap/the_tutorial/controlling_collection_types.html */ template struct less { using result_type = bool; constexpr bool operator()(T const& left, T const& right) const { return std::less()(left, right); } }; template struct equal_to { using result_type = bool; constexpr bool operator()(T const& left, T const& right) const { return std::equal_to()(left, right); } }; #else template using less = std::less; template using equal_to = std::equal_to; #endif } // namespace ripple #endif