Skip to content

Commit b3a43d1

Browse files
authored
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.
1 parent 8b1944d commit b3a43d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/pybind11/stl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ struct variant_caster<V<Ts...>> {
372372
bool load_alternative(handle src, bool convert, type_list<U, Us...>) {
373373
auto caster = make_caster<U>();
374374
if (caster.load(src, convert)) {
375-
value = cast_op<U>(caster);
375+
value = cast_op<U>(std::move(caster));
376376
return true;
377377
}
378378
return load_alternative(src, convert, type_list<Us...>{});

0 commit comments

Comments
 (0)