mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 14:45:12 +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:
parent
8b1944d390
commit
b3a43d137c
@ -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...>{});
|
||||
|
Loading…
Reference in New Issue
Block a user