Skip to content

Commit 5cc25b1

Browse files
committed
add data interface to buffer adaptor
1 parent fbbea57 commit 5cc25b1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

include/xtensor-python/pybuffer_adaptor.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ namespace xt
6666
const_reverse_iterator crbegin() const;
6767
const_reverse_iterator crend() const;
6868

69+
pointer data();
70+
const_pointer data() const;
71+
6972
private:
7073

7174
pointer p_data;
@@ -258,6 +261,18 @@ namespace xt
258261
{
259262
return rend();
260263
}
264+
265+
template <class T>
266+
inline auto pybuffer_adaptor<T>::data() -> pointer
267+
{
268+
return p_data;
269+
}
270+
271+
template <class T>
272+
inline auto pybuffer_adaptor<T>::data() const -> const_pointer
273+
{
274+
return p_data;
275+
}
261276

262277
template<class T>
263278
inline bool operator==(const pybuffer_adaptor<T>& x, const pybuffer_adaptor<T>& y)

0 commit comments

Comments
 (0)