linux compilation fixes

This commit is contained in:
Wenzel Jakob 2015-08-26 17:23:23 +02:00
parent 43dbdfd0e7
commit 328aa14e0a
4 changed files with 18 additions and 18 deletions

View File

@ -104,7 +104,7 @@ template <typename type> class type_caster {
public: public:
typedef instance<type> instance_type; typedef instance<type> instance_type;
static descr descr() { return typeid(type); } static descr name() { return typeid(type); }
type_caster() { type_caster() {
auto const& registered_types = get_internals().registered_types; auto const& registered_types = get_internals().registered_types;
@ -211,7 +211,7 @@ protected:
protected: \ protected: \
type value; \ type value; \
public: \ public: \
static descr descr() { return py_name; } \ static descr name() { return py_name; } \
static PyObject *cast(const type *src, return_value_policy policy, PyObject *parent) { \ static PyObject *cast(const type *src, return_value_policy policy, PyObject *parent) { \
return cast(*src, policy, parent); \ return cast(*src, policy, parent); \
} \ } \
@ -321,7 +321,7 @@ public:
return PyUnicode_DecodeLatin1(str, 1, nullptr); return PyUnicode_DecodeLatin1(str, 1, nullptr);
} }
static descr descr() { return "str"; } static descr name() { return "str"; }
operator char*() { return value; } operator char*() { return value; }
operator char() { return *value; } operator char() { return *value; }
@ -354,11 +354,11 @@ public:
return tuple; return tuple;
} }
static descr descr() { static descr name() {
class descr result("("); class descr result("(");
result += std::move(type_caster<typename decay<T1>::type>::descr()); result += std::move(type_caster<typename decay<T1>::type>::name());
result += ", "; result += ", ";
result += std::move(type_caster<typename decay<T2>::type>::descr()); result += std::move(type_caster<typename decay<T2>::type>::name());
result += ")"; result += ")";
return result; return result;
} }
@ -384,9 +384,9 @@ public:
return cast(src, policy, parent, typename make_index_sequence<size>::type()); return cast(src, policy, parent, typename make_index_sequence<size>::type());
} }
static descr descr(const char **keywords = nullptr, const char **values = nullptr) { static descr name(const char **keywords = nullptr, const char **values = nullptr) {
std::array<class descr, size> descrs {{ std::array<class descr, size> names {{
type_caster<typename decay<Tuple>::type>::descr()... type_caster<typename decay<Tuple>::type>::name()...
}}; }};
class descr result("("); class descr result("(");
for (int i=0; i<size; ++i) { for (int i=0; i<size; ++i) {
@ -394,7 +394,7 @@ public:
result += keywords[i]; result += keywords[i];
result += " : "; result += " : ";
} }
result += std::move(descrs[i]); result += std::move(names[i]);
if (values && values[i]) { if (values && values[i]) {
result += " = "; result += " = ";
result += values[i]; result += values[i];

View File

@ -40,8 +40,8 @@ public:
PYBIND_TYPE_CASTER(type, detail::descr("function<") + PYBIND_TYPE_CASTER(type, detail::descr("function<") +
type_caster<std::tuple<Args...>>::descr() + detail::descr(" -> ") + type_caster<std::tuple<Args...>>::name() + detail::descr(" -> ") +
type_caster<typename decay<Return>::type>::descr() + type_caster<typename decay<Return>::type>::name() +
detail::descr(">")); detail::descr(">"));
}; };

View File

@ -190,9 +190,9 @@ public:
process_extras(((capture *) entry->data)->extras, entry, kw.data(), def.data()); process_extras(((capture *) entry->data)->extras, entry, kw.data(), def.data());
detail::descr d = cast_in::descr(kw.data(), def.data()); detail::descr d = cast_in::name(kw.data(), def.data());
d += " -> "; d += " -> ";
d += std::move(cast_out::descr()); d += std::move(cast_out::name());
initialize(entry, d, sizeof...(Arg)); initialize(entry, d, sizeof...(Arg));
} }
@ -247,9 +247,9 @@ private:
std::array<const char *, N> kw{}, def{}; std::array<const char *, N> kw{}, def{};
process_extras(((capture *) entry->data)->extras, entry, kw.data(), def.data()); process_extras(((capture *) entry->data)->extras, entry, kw.data(), def.data());
detail::descr d = cast_in::descr(kw.data(), def.data()); detail::descr d = cast_in::name(kw.data(), def.data());
d += " -> "; d += " -> ";
d += std::move(cast_out::descr()); d += std::move(cast_out::name());
initialize(entry, d, sizeof...(Arg)); initialize(entry, d, sizeof...(Arg));
} }

View File

@ -54,7 +54,7 @@ public:
} }
return list; return list;
} }
PYBIND_TYPE_CASTER(type, detail::descr("list<") + value_conv::descr() + detail::descr(">")); PYBIND_TYPE_CASTER(type, detail::descr("list<") + value_conv::name() + detail::descr(">"));
}; };
template <typename Key, typename Value> struct type_caster<std::map<Key, Value>> { template <typename Key, typename Value> struct type_caster<std::map<Key, Value>> {
@ -97,7 +97,7 @@ public:
return dict; return dict;
} }
PYBIND_TYPE_CASTER(type, detail::descr("dict<") + key_conv::descr() + detail::descr(", ") + value_conv::descr() + detail::descr(">")); PYBIND_TYPE_CASTER(type, detail::descr("dict<") + key_conv::name() + detail::descr(", ") + value_conv::name() + detail::descr(">"));
}; };
inline std::ostream &operator<<(std::ostream &os, const object &obj) { os << (const char *) obj.str(); return os; } inline std::ostream &operator<<(std::ostream &os, const object &obj) { os << (const char *) obj.str(); return os; }