replace removed std::result_of with std::invoke_result

`std::result_of` was deprecated in C++17 & removed in C++20. A lot of
compilers still make it available even when running in C++20 mode,
while others don't.

Therefore replace it with equivalent use of `std::invoke_result`.

Fixes #3695.
This commit is contained in:
Moritz Bunkus 2024-04-30 16:05:35 +02:00
parent 484f59abe3
commit 7e1bea9527
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,11 @@
# Version ?
## Bug fixes
* fixed compilation of `src/common/sorting.h` with certain compilers due to
the deprecation & removal of `std::result_of<>` in C++20. Fixes #3695.
# Version 84.0 "Sleeper" 2024-04-28
## New features and enhancements

View File

@ -27,7 +27,7 @@ namespace mtx::sort {
template< typename Titer
, typename Tcriterion_maker
, typename Tcriterion = typename std::result_of< Tcriterion_maker(typename std::iterator_traits<Titer>::value_type) >::type
, typename Tcriterion = typename std::invoke_result< Tcriterion_maker, typename std::iterator_traits<Titer>::value_type >::type
, typename Tcomparator = std::less<Tcriterion>
>
void