From 93528f57f33c35c6ae81d2889037611c99445946 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Mon, 28 Aug 2017 14:55:56 +0200 Subject: [PATCH] Document that type_caster requires default-constructible types [skip ci] --- docs/advanced/cast/custom.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/advanced/cast/custom.rst b/docs/advanced/cast/custom.rst index c854e7fcd..e4f99ac5b 100644 --- a/docs/advanced/cast/custom.rst +++ b/docs/advanced/cast/custom.rst @@ -78,6 +78,12 @@ type is explicitly allowed. }; }} // namespace pybind11::detail +.. note:: + + A ``type_caster`` defined with ``PYBIND11_TYPE_CASTER(T, ...)`` requires + that ``T`` is default-constructible (``value`` is first default constructed + and then ``load()`` assigns to it). + .. warning:: When using custom type casters, it's important to declare them consistently