allow a broader set of types in STL containers

This commit is contained in:
Wenzel Jakob 2016-02-23 17:37:10 +01:00
parent 82ba330080
commit 347e6eaf68

View File

@ -27,7 +27,7 @@ NAMESPACE_BEGIN(detail)
template <typename Type, typename Key> struct set_caster {
typedef Type type;
typedef type_caster<Key> key_conv;
typedef type_caster<typename intrinsic_type<Key>::type> key_conv;
bool load(handle src, bool convert) {
pybind11::set s(src, true);
@ -58,8 +58,8 @@ template <typename Type, typename Key> struct set_caster {
template <typename Type, typename Key, typename Value> struct map_caster {
typedef Type type;
typedef type_caster<Key> key_conv;
typedef type_caster<Value> value_conv;
typedef type_caster<typename intrinsic_type<Key>::type> key_conv;
typedef type_caster<typename intrinsic_type<Value>::type> value_conv;
bool load(handle src, bool convert) {
dict d(src, true);
@ -94,7 +94,7 @@ template <typename Type, typename Key, typename Value> struct map_caster {
template <typename Type, typename Value> struct list_caster {
typedef Type type;
typedef type_caster<Value> value_conv;
typedef type_caster<typename intrinsic_type<Value>::type> value_conv;
bool load(handle src, bool convert) {
list l(src, true);
@ -139,7 +139,7 @@ template <typename Type, typename Alloc> struct type_caster<std::list<Type, Allo
template <typename Type, size_t Size> struct type_caster<std::array<Type, Size>> {
typedef std::array<Type, Size> array_type;
typedef type_caster<Type> value_conv;
typedef type_caster<typename intrinsic_type<Type>::type> value_conv;
bool load(handle src, bool convert) {
list l(src, true);