From 16c6db608f1d04233e62e38005e9614f23862054 Mon Sep 17 00:00:00 2001 From: Thomas Spriggs Date: Tue, 14 Nov 2023 17:53:51 +0000 Subject: [PATCH 1/2] Remove explicit return type of the `ranget::map` function Because infering the return type from the template parameters is a sizeable portion of the function implementation. So using an `auto` type tells the compiler that the type is in the return statement and saves us duplicating the same work in two places. --- src/util/range.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util/range.h b/src/util/range.h index c714cdb0464..023b169503a 100644 --- a/src/util/range.h +++ b/src/util/range.h @@ -418,9 +418,7 @@ struct ranget final /// a value through `f`. `f` may take a move-only typed parameter by const /// reference. 'f' may also construct and return a move-only typed value. template - auto map(functiont &&f) -> ranget::type>> + auto map(functiont &&f) { using outputt = typename std::result_of::type; auto shared_f = std::make_shared< From bd69bdbc5df0c9d06b5fa9663f056ee6d4d84a70 Mon Sep 17 00:00:00 2001 From: Thomas Spriggs Date: Tue, 14 Nov 2023 17:57:41 +0000 Subject: [PATCH 2/2] Replace usage of `std::result_of` with `std::invoke_result` C++17 deprecates `std::result_of` in favour of `std::invoke_result`. Updating our code to use the replacement avoids the use of the reprecated version. --- src/util/range.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/range.h b/src/util/range.h index 023b169503a..d884e7635fe 100644 --- a/src/util/range.h +++ b/src/util/range.h @@ -420,7 +420,7 @@ struct ranget final template auto map(functiont &&f) { - using outputt = typename std::result_of::type; + using outputt = typename std::invoke_result::type; auto shared_f = std::make_shared< std::function>( std::forward(f));