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
cc39b2f3
Commit
cc39b2f3
authored
Dec 26, 2015
by
Tomasz Miąsko
Browse files
Add const modifier to handle::cast.
parent
dd57a34e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
docs/reference.rst
docs/reference.rst
+1
-1
include/pybind11/cast.h
include/pybind11/cast.h
+2
-2
include/pybind11/pytypes.h
include/pybind11/pytypes.h
+1
-1
No files found.
docs/reference.rst
View file @
cc39b2f3
...
@@ -118,7 +118,7 @@ Without reference counting
...
@@ -118,7 +118,7 @@ Without reference counting
Return a string representation of the object. This is analogous to
Return a string representation of the object. This is analogous to
the ``str()`` function in Python.
the ``str()`` function in Python.
.. function:: template <typename T> T handle::cast()
.. function:: template <typename T> T handle::cast()
const
Attempt to cast the Python object into the given C++ type. A
Attempt to cast the Python object into the given C++ type. A
:class:`cast_error` will be throw upon failure.
:class:`cast_error` will be throw upon failure.
...
...
include/pybind11/cast.h
View file @
cc39b2f3
...
@@ -594,8 +594,8 @@ template <typename T> inline object cast(const T &value, return_value_policy pol
...
@@ -594,8 +594,8 @@ template <typename T> inline object cast(const T &value, return_value_policy pol
return
object
(
detail
::
type_caster
<
typename
detail
::
decay
<
T
>::
type
>::
cast
(
value
,
policy
,
parent
),
false
);
return
object
(
detail
::
type_caster
<
typename
detail
::
decay
<
T
>::
type
>::
cast
(
value
,
policy
,
parent
),
false
);
}
}
template
<
typename
T
>
inline
T
handle
::
cast
()
{
return
pybind11
::
cast
<
T
>
(
m_ptr
);
}
template
<
typename
T
>
inline
T
handle
::
cast
()
const
{
return
pybind11
::
cast
<
T
>
(
m_ptr
);
}
template
<
>
inline
void
handle
::
cast
()
{
return
;
}
template
<
>
inline
void
handle
::
cast
()
const
{
return
;
}
template
<
typename
...
Args
>
inline
object
handle
::
call
(
Args
&&
...
args_
)
{
template
<
typename
...
Args
>
inline
object
handle
::
call
(
Args
&&
...
args_
)
{
const
size_t
size
=
sizeof
...(
Args
);
const
size_t
size
=
sizeof
...(
Args
);
...
...
include/pybind11/pytypes.h
View file @
cc39b2f3
...
@@ -42,7 +42,7 @@ public:
...
@@ -42,7 +42,7 @@ public:
inline
detail
::
accessor
attr
(
handle
key
);
inline
detail
::
accessor
attr
(
handle
key
);
inline
detail
::
accessor
attr
(
const
char
*
key
);
inline
detail
::
accessor
attr
(
const
char
*
key
);
inline
pybind11
::
str
str
()
const
;
inline
pybind11
::
str
str
()
const
;
template
<
typename
T
>
T
cast
();
template
<
typename
T
>
T
cast
()
const
;
template
<
typename
...
Args
>
object
call
(
Args
&&
...
args_
);
template
<
typename
...
Args
>
object
call
(
Args
&&
...
args_
);
operator
bool
()
const
{
return
m_ptr
!=
nullptr
;
}
operator
bool
()
const
{
return
m_ptr
!=
nullptr
;
}
bool
check
()
const
{
return
m_ptr
!=
nullptr
;
}
bool
check
()
const
{
return
m_ptr
!=
nullptr
;
}
...
...
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