Commit Graph

5 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve 05c8b9b7a8 Automatic `pre-commit run --all-files` and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
Ralf W. Grosse-Kunstleve 52c3f4cc30
This was meant to be PR #3065: pure clang-format changes. NO manual changes. (#3073) 2021-07-02 16:51:24 -07:00
Ralf W. Grosse-Kunstleve 6c922614ed
Adding reclaim_disowned logic & miscellaneous naming and documentation improvements. (#2943)
* Using new smart_holder::reclaim_disowned in smart_holder_type_caster for unique_ptr.

* Systematically renaming was_disowned to is_disowned (because disowning is now reversible: reclaim_disowned).

* Systematically renaming virtual_overrider_self_life_support to trampoline_self_life_support (to reuse existing terminology instead of introducing new one).

* Systematically renaming test_class_sh_with_alias to test_class_sh_trampoline_basic.

* Adding a Trampolines and std::unique_ptr section to README_smart_holder.rst.

* MSVC compatibility.
2021-04-09 23:08:44 -07:00
Ralf W. Grosse-Kunstleve 08339d6331
Adding tests to exercise corner cases involving disowning. (#2912)
* Adding test_class_sh_disowning.

* Fixing minor namespace naming inconsistency between test_class_sh_*.cpp files.

* Replacing py::overload_cast with plain cast for C++11 compatibility.

* Accommodate that the C++ order of evaluation of function arguments is unspecified.
2021-03-22 12:16:29 -07:00
Ralf W. Grosse-Kunstleve 5319ca3817
Using `dynamic_cast<AliasType>` to determine `pointee_depends_on_holder_owner`. (#2910)
* Adaption of PyCLIF virtual_py_cpp_mix test.

* Removing ValueError: Ownership of instance with virtual overrides in Python cannot be transferred to C++. TODO: static_assert alias class needs to inherit from virtual_overrider_self_life_support.

* Bringing back ValueError: "... instance cannot safely be transferred to C++.", but based on dynamic_cast<AliasType>.

* Fixing oversight: adding test_class_sh_virtual_py_cpp_mix.cpp to cmake file.

* clang <= 3.6 compatibility.

* Fixing oversight: dynamic_raw_ptr_cast_if_possible needs special handling for To = void. Adding corresponding missing test in test_class_sh_virtual_py_cpp_mix. Moving dynamic_raw_ptr_cast_if_possible to separate header.

* Changing py::detail::virtual_overrider_self_life_support to py::virtual_overrider_self_life_support.
2021-03-19 12:18:39 -07:00