pybind11/example
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
..
CMakeLists.txt Improve CI test coverage: eigen, numpy and C++14 2016-07-30 17:18:33 +02:00
eigen.cpp Add support for Eigen::Ref<...> function arguments 2016-08-03 16:50:22 -04:00
eigen.py Add support for Eigen::Ref<...> function arguments 2016-08-03 16:50:22 -04:00
eigen.ref Add support for Eigen::Ref<...> function arguments 2016-08-03 16:50:22 -04:00
example-arg-keywords-and-defaults.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-arg-keywords-and-defaults.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-arg-keywords-and-defaults.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-buffers.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-buffers.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-buffers.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-callbacks.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-callbacks.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-callbacks.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-constants-and-functions.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-constants-and-functions.py Enable comparisons between enums and their underlying types 2016-08-02 11:33:48 -04:00
example-constants-and-functions.ref Enable comparisons between enums and their underlying types 2016-08-02 11:33:48 -04:00
example-custom-exceptions.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-custom-exceptions.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-custom-exceptions.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-eval_call.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-eval.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-eval.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-eval.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-inheritance.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-inheritance.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-inheritance.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-keep-alive.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-keep-alive.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-keep-alive.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-methods-and-attributes.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-methods-and-attributes.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-methods-and-attributes.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-modules.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-modules.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-modules.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-numpy-vectorize.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-numpy-vectorize.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-numpy-vectorize.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-opaque-types.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-opaque-types.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-opaque-types.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-operator-overloading.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-operator-overloading.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-operator-overloading.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-pickling.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-pickling.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-pickling.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-python-types.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-python-types.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-python-types.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-sequences-and-iterators.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-sequences-and-iterators.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-sequences-and-iterators.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-smart-ptr.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-smart-ptr.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-smart-ptr.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-stl-binder-vector.cpp minor namespace change in example 2016-07-19 17:35:09 +02:00
example-stl-binder-vector.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-stl-binder-vector.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-virtual-functions.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-virtual-functions.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example-virtual-functions.ref Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example.cpp Rename examples files, as per #288 2016-07-18 16:43:18 -04:00
example.h last breaking change: be consistent about the project name 2015-10-15 18:23:56 +02:00
issues.cpp Fix #283: don't print first arg of constructor 2016-07-17 17:47:05 -04:00
issues.py Fix #283: don't print first arg of constructor 2016-07-17 17:47:05 -04:00
issues.ref Fix #283: don't print first arg of constructor 2016-07-17 17:47:05 -04:00
object.h Initial commit 2015-07-09 15:27:32 +02:00
run_test.py Rename examples files, as per #288 2016-07-18 16:43:18 -04:00