"example/example-smart-ptr.py" did not exist on "2ca07de83c3cc6a2cb285eb82d4dc9c3ed4fe8a0"
Unverified Commit b3a43d13 authored by Laramie Leavitt's avatar Laramie Leavitt Committed by GitHub
Browse files

Use rvalue reference for std::variant cast_op<T> (#3811)

Nearly every call site of cast_op<T> uses an r-value reference.

Except stl.h variant_caster::load_alternative for handling std::variant.

Fix that.
parent 8b1944d3
...@@ -372,7 +372,7 @@ struct variant_caster<V<Ts...>> { ...@@ -372,7 +372,7 @@ struct variant_caster<V<Ts...>> {
bool load_alternative(handle src, bool convert, type_list<U, Us...>) { bool load_alternative(handle src, bool convert, type_list<U, Us...>) {
auto caster = make_caster<U>(); auto caster = make_caster<U>();
if (caster.load(src, convert)) { if (caster.load(src, convert)) {
value = cast_op<U>(caster); value = cast_op<U>(std::move(caster));
return true; return true;
} }
return load_alternative(src, convert, type_list<Us...>{}); return load_alternative(src, convert, type_list<Us...>{});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment