mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +00:00
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.
This commit is contained in:
@@ -372,7 +372,7 @@ struct variant_caster<V<Ts...>> {
|
||||
bool load_alternative(handle src, bool convert, type_list<U, Us...>) {
|
||||
auto caster = make_caster<U>();
|
||||
if (caster.load(src, convert)) {
|
||||
value = cast_op<U>(caster);
|
||||
value = cast_op<U>(std::move(caster));
|
||||
return true;
|
||||
}
|
||||
return load_alternative(src, convert, type_list<Us...>{});
|
||||
|
||||
Reference in New Issue
Block a user