Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
5a6aa491
Commit
5a6aa491
authored
Apr 13, 2016
by
Wenzel Jakob
Browse files
Added len() function
parent
1a060fd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
include/pybind11/pytypes.h
include/pybind11/pytypes.h
+7
-0
No files found.
include/pybind11/pytypes.h
View file @
5a6aa491
...
...
@@ -461,4 +461,11 @@ public:
}
};
inline
size_t
len
(
handle
h
)
{
ssize_t
result
=
PyObject_Length
(
h
.
ptr
());
if
(
result
<
0
)
pybind11_fail
(
"Unable to compute length of object"
);
return
(
size_t
)
result
;
}
NAMESPACE_END
(
pybind11
)
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