Skip to content

Commit

Permalink
Perfect forwarding for containers
Browse files Browse the repository at this point in the history
  • Loading branch information
endurodave committed Dec 13, 2024
1 parent 7858e4e commit 14e0bdb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Delegate/MulticastDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MulticastDelegate<RetType(Args...)>
/// @param[in] args The farguments used when invoking the target function
void operator()(Args... args) {
for (Delegate<RetType(Args...)>* delegate : m_delegates)
(*delegate)(args...); // Invoke delegate callback
(*delegate)(std::forward<Args>(args)...); // Invoke delegate callback
}

/// Insert a delegate into the container.
Expand Down
2 changes: 1 addition & 1 deletion src/Delegate/SinglecastDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SinglecastDelegate<RetType(Args...)>
~SinglecastDelegate() { Clear(); }

RetType operator()(Args... args) {
return (*m_delegate)(args...); // Invoke delegate callback
return (*m_delegate)(std::forward<Args>(args)...); // Invoke delegate callback
}

void operator=(const Delegate<RetType(Args...)>& delegate) {
Expand Down

0 comments on commit 14e0bdb

Please sign in to comment.