mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 09:25:51 +00:00
fix(smart_holder): Use std::default_delete. (#4924)
Ensures `std::default_delete<T>` is used to look up the deleter for a type instead of `delete` directly.
This commit is contained in:
parent
edfaaed87e
commit
e02fe001cd
@ -103,7 +103,7 @@ struct guarded_delete {
|
||||
|
||||
template <typename T, typename std::enable_if<std::is_destructible<T>::value, int>::type = 0>
|
||||
inline void builtin_delete_if_destructible(void *raw_ptr) {
|
||||
delete static_cast<T *>(raw_ptr);
|
||||
std::default_delete<T>{}(static_cast<T *>(raw_ptr));
|
||||
}
|
||||
|
||||
template <typename T, typename std::enable_if<!std::is_destructible<T>::value, int>::type = 0>
|
||||
|
Loading…
Reference in New Issue
Block a user