pybind11/docs/advanced
Bruce Merry b82c0f0a2d Allow std::complex field with PYBIND11_NUMPY_DTYPE (#831)
This exposed a few underlying issues:

1. is_pod_struct was too strict to allow this. I've relaxed it to
require only trivially copyable and standard layout, rather than POD
(which additionally requires a trivial constructor, which std::complex
violates).

2. format_descriptor<std::complex<T>>::format() returned numpy format
strings instead of PEP3118 format strings, but register_dtype
feeds format codes of its fields to _dtype_from_pep3118. I've changed it
to return PEP3118 format codes. format_descriptor is a public type, so
this may be considered an incompatible change.

3. register_structured_dtype tried to be smart about whether to mark
fields as unaligned (with ^). However, it's examining the C++ alignment,
rather than what numpy (or possibly PEP3118) thinks the alignment should
be. For complex values those are different. I've made it mark all fields
as ^ unconditionally, which should always be safe even if they are
aligned, because we explicitly mark the padding.
2017-05-10 11:36:24 +02:00
..
cast Add type caster for std::variant and other variant-like classes 2017-04-29 17:31:30 +02:00
pycpp Allow std::complex field with PYBIND11_NUMPY_DTYPE (#831) 2017-05-10 11:36:24 +02:00
classes.rst added note about trailing commas (fixes #593) 2017-03-22 21:39:19 +01:00
exceptions.rst Reorganize documentation 2016-10-20 15:21:34 +02:00
functions.rst Add a scope guard call policy 2017-04-03 00:52:47 +02:00
misc.rst Add a scope guard call policy 2017-04-03 00:52:47 +02:00
smart_ptrs.rst Improve custom holder support (#607) 2017-01-31 17:05:44 +01:00