Skip to content

Commit 683fff4

Browse files
committed
Write "shared_ptr" instead of just "pointer" in a couple places in docs/advanced/classes.rst
1 parent bad0c12 commit 683fff4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/advanced/classes.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,9 @@ Avoiding Inheritance Slicing and ``std::weak_ptr`` surprises
434434
When working with classes that use virtual functions and are subclassed
435435
in Python, special care must be taken when converting Python objects to
436436
``std::shared_ptr<T>``. Depending on whether the class uses a plain
437-
``std::shared_ptr`` holder or ``py::smart_holder``, the resulting pointer
438-
may either allow inheritance slicing or lead to potentially surprising behavior
439-
when constructing ``std::weak_ptr`` instances.
437+
``std::shared_ptr`` holder or ``py::smart_holder``, the resulting
438+
``shared_ptr`` may either allow inheritance slicing or lead to potentially
439+
surprising behavior when constructing ``std::weak_ptr`` instances.
440440

441441
This section explains how ``std::shared_ptr`` and ``py::smart_holder`` manage
442442
object lifetimes differently, how these differences affect trampoline-derived
@@ -446,9 +446,9 @@ desired behavior.
446446
When using ``std::shared_ptr`` as the holder type, converting a Python object
447447
to a ``std::shared_ptr<T>`` (e.g., ``obj.cast<std::shared_ptr<T>>()``, or simply
448448
passing the Python object as an argument to a ``.def()``-ed function) returns
449-
a pointer that shares ownership with the original ``class_`` holder, usually
450-
preserving object lifetime. However, for Python classes that derive from a
451-
trampoline, if the Python object is destroyed, only the base C++ object may
449+
a ``shared_ptr`` that shares ownership with the original ``class_`` holder,
450+
usually preserving object lifetime. However, for Python classes that derive from
451+
a trampoline, if the Python object is destroyed, only the base C++ object may
452452
remain alive, leading to inheritance slicing
453453
(see `#1333 <https://github.com/pybind/pybind11/issues/1333>`_).
454454

0 commit comments

Comments
 (0)