mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-01 17:37:15 +00:00
Resolve clang-tidy errors:
``` /__w/pybind11/pybind11/include/pybind11/cast.h:918:44: error: std::move of the variable 'v_h' of the trivially-copyable type 'pybind11::detail::value_and_holder' has no effect [performance-move-const-arg,-warnings-as-errors] return load_value_smart_holder(std::move(v_h)); ^ /__w/pybind11/pybind11/include/pybind11/cast.h:911:53: note: consider changing the 1st parameter of 'load_value_smart_holder' from 'pybind11::detail::value_and_holder &&' to 'const pybind11::detail::value_and_holder &' bool load_value_smart_holder(value_and_holder &&v_h) { ^ /__w/pybind11/pybind11/include/pybind11/cast.h:920:38: error: std::move of the variable 'v_h' of the trivially-copyable type 'pybind11::detail::value_and_holder' has no effect [performance-move-const-arg,-warnings-as-errors] return load_value_shared_ptr(std::move(v_h)); ^ /__w/pybind11/pybind11/include/pybind11/cast.h:895:51: note: consider changing the 1st parameter of 'load_value_shared_ptr' from 'pybind11::detail::value_and_holder &&' to 'const pybind11::detail::value_and_holder &' bool load_value_shared_ptr(value_and_holder &&v_h) { ^ ```
This commit is contained in:
parent
fc5678b08b
commit
af66246fb6
@ -892,7 +892,7 @@ protected:
|
|||||||
friend class type_caster_generic;
|
friend class type_caster_generic;
|
||||||
void check_holder_compat() {}
|
void check_holder_compat() {}
|
||||||
|
|
||||||
bool load_value_shared_ptr(value_and_holder &&v_h) {
|
bool load_value_shared_ptr(const value_and_holder &v_h) {
|
||||||
if (v_h.holder_constructed()) {
|
if (v_h.holder_constructed()) {
|
||||||
value = v_h.value_ptr();
|
value = v_h.value_ptr();
|
||||||
shared_ptr_holder = v_h.template holder<std::shared_ptr<type>>();
|
shared_ptr_holder = v_h.template holder<std::shared_ptr<type>>();
|
||||||
@ -908,16 +908,16 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool load_value_smart_holder(value_and_holder &&v_h) {
|
bool load_value_smart_holder(const value_and_holder &v_h) {
|
||||||
loaded_v_h = v_h;
|
loaded_v_h = v_h;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool load_value(value_and_holder &&v_h) {
|
bool load_value(value_and_holder &&v_h) {
|
||||||
if (typeinfo->default_holder) {
|
if (typeinfo->default_holder) {
|
||||||
return load_value_smart_holder(std::move(v_h));
|
return load_value_smart_holder(v_h);
|
||||||
}
|
}
|
||||||
return load_value_shared_ptr(std::move(v_h));
|
return load_value_shared_ptr(v_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T = std::shared_ptr<type>,
|
template <typename T = std::shared_ptr<type>,
|
||||||
|
Loading…
Reference in New Issue
Block a user