Skip to content

Commit 7dd4d08

Browse files
committed
Revert "Fix perfect forwarding"
This reverts commit e4a568f.
1 parent f130cdd commit 7dd4d08

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

include/pybind11/detail/init.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ struct factory<Func, void_type (*)(), Return(Args...)> {
234234
auto &func = class_factory;
235235
cl.def("__init__", [func]
236236
#endif
237-
(value_and_holder &v_h, Args&&... args) {
237+
(value_and_holder &v_h, Args... args) {
238238
construct<Class>(v_h, func(std::forward<Args>(args)...),
239239
Py_TYPE(v_h.inst) != v_h.type->type);
240240
}, is_new_style_constructor(), extra...);
@@ -324,7 +324,7 @@ struct pickle_factory<Get, Set, RetState(Self), NewInstance(ArgState)> {
324324
auto &func = set;
325325
cl.def("__setstate__", [func]
326326
#endif
327-
(value_and_holder &v_h, ArgState&& state) {
327+
(value_and_holder &v_h, ArgState state) {
328328
setstate<Class>(v_h, func(std::forward<ArgState>(state)),
329329
Py_TYPE(v_h.inst) != v_h.type->type);
330330
}, is_new_style_constructor(), extra...);

include/pybind11/functional.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct type_caster<std::function<Return(Args...)>> {
7272
struct func_wrapper {
7373
func_handle hfunc;
7474
func_wrapper(func_handle&& hf): hfunc(std::move(hf)) {}
75-
Return operator()(Args&&... args) const {
75+
Return operator()(Args... args) const {
7676
gil_scoped_acquire acq;
7777
object retval(hfunc.f(std::forward<Args>(args)...));
7878
/* Visual studio 2015 parser issue: need parentheses around this expression */

include/pybind11/pybind11.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class cpp_function : public function {
9090
/// but with an added `&`.
9191
template <typename Return, typename Class, typename... Arg, typename... Extra>
9292
cpp_function(Return (Class::*f)(Arg...)&, const Extra&... extra) {
93-
initialize([f](Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
93+
initialize([f](Class *c, Arg... args) -> Return { return (c->*f)(args...); },
9494
(Return (*) (Class *, Arg...)) nullptr, extra...);
9595
}
9696

@@ -106,7 +106,7 @@ class cpp_function : public function {
106106
/// but with an added `&`.
107107
template <typename Return, typename Class, typename... Arg, typename... Extra>
108108
cpp_function(Return (Class::*f)(Arg...) const&, const Extra&... extra) {
109-
initialize([f](const Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
109+
initialize([f](const Class *c, Arg... args) -> Return { return (c->*f)(args...); },
110110
(Return (*)(const Class *, Arg ...)) nullptr, extra...);
111111
}
112112

tests/test_copy_move.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def test_move_and_copy_loads():
6464
assert c_m.move_assignments == 6
6565
assert c_m.move_constructions == 9
6666
assert c_mc.copy_assignments == 0
67-
assert c_mc.copy_constructions == 1
67+
assert c_mc.copy_constructions == 5
6868
assert c_mc.move_assignments == 6
69-
assert c_mc.move_constructions == 8
69+
assert c_mc.move_constructions == 4
7070
assert c_c.copy_assignments == 4
7171
assert c_c.copy_constructions == 6
7272
assert c_m.alive() + c_mc.alive() + c_c.alive() == 0

0 commit comments

Comments
 (0)