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
98ba98c0
Commit
98ba98c0
authored
Jul 24, 2016
by
Ivan Smirnov
Browse files
Add a simplified buffer_info ctor for 1-D case
parent
6636ae9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
include/pybind11/common.h
include/pybind11/common.h
+5
-0
No files found.
include/pybind11/common.h
View file @
98ba98c0
...
...
@@ -210,6 +210,7 @@ struct buffer_info {
std
::
vector
<
size_t
>
strides
;
// Number of entries between adjacent entries (for each per dimension)
buffer_info
()
:
ptr
(
nullptr
),
view
(
nullptr
)
{}
buffer_info
(
void
*
ptr
,
size_t
itemsize
,
const
std
::
string
&
format
,
size_t
ndim
,
const
std
::
vector
<
size_t
>
&
shape
,
const
std
::
vector
<
size_t
>
&
strides
)
:
ptr
(
ptr
),
itemsize
(
itemsize
),
size
(
1
),
format
(
format
),
...
...
@@ -218,6 +219,10 @@ struct buffer_info {
size
*=
shape
[
i
];
}
buffer_info
(
void
*
ptr
,
size_t
itemsize
,
const
std
::
string
&
format
,
size_t
size
)
:
buffer_info
(
ptr
,
itemsize
,
format
,
1
,
std
::
vector
<
size_t
>
{
size
},
std
::
vector
<
size_t
>
{
itemsize
})
{
}
buffer_info
(
Py_buffer
*
view
)
:
ptr
(
view
->
buf
),
itemsize
((
size_t
)
view
->
itemsize
),
size
(
1
),
format
(
view
->
format
),
ndim
((
size_t
)
view
->
ndim
),
shape
((
size_t
)
view
->
ndim
),
strides
((
size_t
)
view
->
ndim
),
view
(
view
)
{
...
...
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