pybind11/include/pybind11
Jason Rhinelander 5fd5074a0b Add support for Eigen::Ref<...> function arguments
Eigen::Ref is a common way to pass eigen dense types without needing a
template, e.g. the single definition `void
func(Eigen::Ref<Eigen::MatrixXd> x)` can be called with any double
matrix-like object.

The current pybind11 eigen support fails with internal errors if
attempting to bind a function with an Eigen::Ref<...> argument because
Eigen::Ref<...> satisfies the "is_eigen_dense" requirement, but can't
compile if actually used: Eigen::Ref<...> itself is not default
constructible, and so the argument std::tuple containing an
Eigen::Ref<...> isn't constructible, which results in compilation
failure.

This commit adds support for Eigen::Ref<...> by giving it its own
type_caster implementation which consists of an internal type_caster of
the referenced type, load/cast methods that dispatch to the internal
type_caster, and a unique_ptr to an Eigen::Ref<> instance that gets
set during load().

There is, of course, no performance advantage for pybind11-using code of
using Eigen::Ref<...>--we are allocating a matrix of the derived type
when loading it--but this has the advantage of allowing pybind11 to bind
transparently to C++ methods taking Eigen::Refs.
2016-08-03 16:50:22 -04:00
..
attr.h avoid C++ -> Python -> C++ overheads when passing around function objects 2016-07-10 10:44:44 +02:00
cast.h exception handler tweaks (fixes #284) 2016-07-18 10:46:41 +02:00
common.h check for NOMINMAX issue on windows (fixes #291) 2016-07-19 17:47:59 +02:00
complex.h nicer type_caster::load() calling conventions 2016-05-15 20:23:27 +02:00
descr.h descr<> fix for int-to-string conversion 2016-07-19 11:59:37 +02:00
eigen.h Add support for Eigen::Ref<...> function arguments 2016-08-03 16:50:22 -04:00
eval.h Python 2.7 fixes for eval() 2016-07-08 15:14:48 +02:00
functional.h avoid C++ -> Python -> C++ overheads when passing around function objects 2016-07-10 10:44:44 +02:00
numpy.h fixed many conversion warnings on clang 2016-05-29 13:40:40 +02:00
operators.h minor cleanups in common.h; updated author info and copyright year 2016-04-18 10:53:38 +02:00
pybind11.h Fix zero valued enum comparison error 2016-08-03 10:36:22 -04:00
pytypes.h Changes accessor::operator=() to throw error_already_set() instead of using pybind11_fail(). 2016-08-01 08:45:16 +02:00
stl_bind.h gcc fix 2016-05-30 11:45:02 +02:00
stl.h transparent conversion of dense and sparse Eigen types 2016-05-05 21:44:29 +02:00
typeid.h minor cleanups in common.h; updated author info and copyright year 2016-04-18 10:53:38 +02:00