Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
fd7cf51a
Commit
fd7cf51a
authored
Apr 30, 2016
by
Wenzel Jakob
Browse files
enabled casting of const void*
parent
f02f4165
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
include/pybind11/cast.h
include/pybind11/cast.h
+1
-1
include/pybind11/pytypes.h
include/pybind11/pytypes.h
+2
-2
No files found.
include/pybind11/cast.h
View file @
fd7cf51a
...
@@ -389,7 +389,7 @@ public:
...
@@ -389,7 +389,7 @@ public:
return
true
;
return
true
;
}
}
static
handle
cast
(
void
*
ptr
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
static
handle
cast
(
const
void
*
ptr
,
return_value_policy
/* policy */
,
handle
/* parent */
)
{
if
(
ptr
)
if
(
ptr
)
return
capsule
(
ptr
).
release
();
return
capsule
(
ptr
).
release
();
else
else
...
...
include/pybind11/pytypes.h
View file @
fd7cf51a
...
@@ -451,8 +451,8 @@ class capsule : public object {
...
@@ -451,8 +451,8 @@ class capsule : public object {
public:
public:
PYBIND11_OBJECT_DEFAULT
(
capsule
,
object
,
PyCapsule_CheckExact
)
PYBIND11_OBJECT_DEFAULT
(
capsule
,
object
,
PyCapsule_CheckExact
)
capsule
(
PyObject
*
obj
,
bool
borrowed
)
:
object
(
obj
,
borrowed
)
{
}
capsule
(
PyObject
*
obj
,
bool
borrowed
)
:
object
(
obj
,
borrowed
)
{
}
capsule
(
void
*
value
,
void
(
*
destruct
)(
PyObject
*
)
=
nullptr
)
capsule
(
const
void
*
value
,
void
(
*
destruct
)(
PyObject
*
)
=
nullptr
)
:
object
(
PyCapsule_New
(
value
,
nullptr
,
destruct
),
false
)
{
:
object
(
PyCapsule_New
(
const_cast
<
void
*>
(
value
)
,
nullptr
,
destruct
),
false
)
{
if
(
!
m_ptr
)
pybind11_fail
(
"Could not allocate capsule object!"
);
if
(
!
m_ptr
)
pybind11_fail
(
"Could not allocate capsule object!"
);
}
}
template
<
typename
T
>
operator
T
*
()
const
{
template
<
typename
T
>
operator
T
*
()
const
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment