Skip to content

Commit 93528f5

Browse files
committed
Document that type_caster requires default-constructible types
[skip ci]
1 parent 5f317e6 commit 93528f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/advanced/cast/custom.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ type is explicitly allowed.
7878
};
7979
}} // namespace pybind11::detail
8080
81+
.. note::
82+
83+
A ``type_caster<T>`` defined with ``PYBIND11_TYPE_CASTER(T, ...)`` requires
84+
that ``T`` is default-constructible (``value`` is first default constructed
85+
and then ``load()`` assigns to it).
86+
8187
.. warning::
8288

8389
When using custom type casters, it's important to declare them consistently

0 commit comments

Comments
 (0)