added caster for std::reference_wrapper (fixes #171)

This commit is contained in:
Wenzel Jakob
2016-04-20 17:00:57 +02:00
parent afb9c1776a
commit f54ded74f1
4 changed files with 31 additions and 9 deletions

View File

@@ -241,6 +241,13 @@ protected:
static void *copy_constructor(const void *) { return nullptr; }
};
template <typename type> class type_caster<std::reference_wrapper<type>> : public type_caster<type> {
public:
static handle cast(const std::reference_wrapper<type> &src, return_value_policy policy, handle parent) {
return type_caster<type>::cast(&src.get(), policy, parent);
}
};
#define PYBIND11_TYPE_CASTER(type, py_name) \
protected: \
type value; \