Skip to content

Commit

Permalink
function_ref should not always reference qualify parameters
Browse files Browse the repository at this point in the history
By accepting `Args&&...`, a function that accepts its arguments by value is required to accept only rvalues. Instead, we should accept `Args...` (the exact argument types listed in the signature), which allows by-value parameters to copy from lvalue arguments.
  • Loading branch information
davidstone authored Oct 10, 2024
1 parent 1a8bb0b commit f123a0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/boost/compat/function_ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct function_ref_base {
function_ref_base(const function_ref_base&) noexcept = default;
function_ref_base& operator=(const function_ref_base&) noexcept = default;

R operator()(Args&&... args) const noexcept(NoEx) { return this->invoke_(thunk_, std::forward<Args>(args)...); }
R operator()(Args... args) const noexcept(NoEx) { return this->invoke_(thunk_, std::forward<Args>(args)...); }
};

} // namespace detail
Expand Down

0 comments on commit f123a0d

Please sign in to comment.