mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 21:25:13 +00:00
fixed docstring generation for void pointers
This commit is contained in:
parent
fd7cf51a56
commit
e8b9dd263c
@ -8,6 +8,7 @@ from example import ClassWithSTLVecProperty
|
|||||||
from example import return_void_ptr, print_void_ptr
|
from example import return_void_ptr, print_void_ptr
|
||||||
from example import return_null_str, print_null_str
|
from example import return_null_str, print_null_str
|
||||||
from example import return_unique_ptr
|
from example import return_unique_ptr
|
||||||
|
from example import Example1
|
||||||
|
|
||||||
#####
|
#####
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ print_opaque_list(cvp.stringList)
|
|||||||
#####
|
#####
|
||||||
|
|
||||||
print_void_ptr(return_void_ptr())
|
print_void_ptr(return_void_ptr())
|
||||||
|
print_void_ptr(Example1()) # Should also work for other C++ types
|
||||||
|
|
||||||
print(return_null_str())
|
print(return_null_str())
|
||||||
print_null_str(return_null_str())
|
print_null_str(return_null_str())
|
||||||
|
@ -398,6 +398,7 @@ public:
|
|||||||
|
|
||||||
template <typename T> using cast_op_type = void*&;
|
template <typename T> using cast_op_type = void*&;
|
||||||
operator void *&() { return value; }
|
operator void *&() { return value; }
|
||||||
|
static PYBIND11_DESCR name() { return _("capsule"); }
|
||||||
private:
|
private:
|
||||||
void *value = nullptr;
|
void *value = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,7 @@ NAMESPACE_BEGIN(detail)
|
|||||||
|
|
||||||
template <typename Return, typename... Args> struct type_caster<std::function<Return(Args...)>> {
|
template <typename Return, typename... Args> struct type_caster<std::function<Return(Args...)>> {
|
||||||
typedef std::function<Return(Args...)> type;
|
typedef std::function<Return(Args...)> type;
|
||||||
|
typedef typename std::conditional<std::is_same<Return, void>::value, void_type, Return>::type retval_type;
|
||||||
public:
|
public:
|
||||||
bool load(handle src_, bool) {
|
bool load(handle src_, bool) {
|
||||||
src_ = detail::get_function(src_);
|
src_ = detail::get_function(src_);
|
||||||
@ -39,7 +40,7 @@ public:
|
|||||||
|
|
||||||
PYBIND11_TYPE_CASTER(type, _("function<") +
|
PYBIND11_TYPE_CASTER(type, _("function<") +
|
||||||
type_caster<std::tuple<Args...>>::name() + _(" -> ") +
|
type_caster<std::tuple<Args...>>::name() + _(" -> ") +
|
||||||
type_caster<typename intrinsic_type<Return>::type>::name() +
|
type_caster<retval_type>::name() +
|
||||||
_(">"));
|
_(">"));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user