Skip to content

Commit 85e2fa3

Browse files
authored
fix missing forward for function object parameter (#2092)
1 parent 48d57dc commit 85e2fa3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CppCoreGuidelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,9 +3142,9 @@ In that case, and only that case, make the parameter `TP&&` where `TP` is a temp
31423142
Usually you forward the entire parameter (or parameter pack, using `...`) exactly once on every static control flow path:
31433143

31443144
template<class F, class... Args>
3145-
inline auto invoke(F f, Args&&... args)
3145+
inline decltype(auto) invoke(F&& f, Args&&... args)
31463146
{
3147-
return f(forward<Args>(args)...);
3147+
return forward<F>(f)(forward<Args>(args)...);
31483148
}
31493149

31503150
##### Example

0 commit comments

Comments
 (0)