General: Fix compilation for GCC

This commit is contained in:
Liam White 2022-04-13 21:02:55 +02:00 committed by Fernando Sahmkow
parent fd7afda1e8
commit afab6c143c
16 changed files with 56 additions and 42 deletions

View file

@ -27,7 +27,7 @@ template <class ForwardIt, class T, class Compare = std::less<>>
template <typename T, typename Func, typename... Args>
T FoldRight(T initial_value, Func&& func, Args&&... args) {
T value{initial_value};
const auto high_func = [&value, &func]<typename T>(T x) { value = func(value, x); };
const auto high_func = [&value, &func]<typename U>(U x) { value = func(value, x); };
(std::invoke(high_func, std::forward<Args>(args)), ...);
return value;
}