-
Notifications
You must be signed in to change notification settings - Fork 432
For discussion: use dedicated shape objects #374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e9cf857
802c6ec
c764648
73ba2e3
1ec55ca
488385e
ac2aa87
e4a7bb9
77f6621
c50d1bc
13969b0
098908c
c27819c
298bd23
10e7bb9
85f9f60
1b7a2c7
bf747c4
bc10395
07f01e6
7dd9b64
55b9d22
6d43ea4
2f1d7ea
1fab593
9064941
eed85b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,7 +89,7 @@ namespace xt | |
| */ | ||
| template <class C, std::size_t N, layout_type L = DEFAULT_LAYOUT> | ||
| xtensor_adaptor<C, N, L> | ||
| xadapt(C& container, const std::array<typename C::size_type, N>& shape, layout_type l = L); | ||
| xadapt(C& container, const stat_shape<typename C::size_type, N>& shape, layout_type l = L); | ||
|
|
||
| /** | ||
| * Constructs an xtensor_adaptor of the given stl-like container, | ||
|
|
@@ -100,7 +100,7 @@ namespace xt | |
| */ | ||
| template <class C, std::size_t N> | ||
| xtensor_adaptor<C, N, layout_type::dynamic> | ||
| xadapt(C& container, const std::array<typename C::size_type, N>& shape, const std::array<typename C::size_type, N>& strides); | ||
| xadapt(C& container, const stat_shape<typename C::size_type, N>& shape, const stat_shape<typename C::size_type, N>& strides); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think in terms of naming i would prefer
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ie. xshape<3> == stat_shape, and xshape() == dyn_shape...
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On that note, I also think we shouldn't use the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that |
||
|
|
||
| /** | ||
| * Constructs an xtensor_adaptor of the given dynamically allocated C array, | ||
|
|
@@ -116,7 +116,7 @@ namespace xt | |
| template <class P, std::size_t N, class O, layout_type L = DEFAULT_LAYOUT, class A = std::allocator<std::remove_pointer_t<P>>> | ||
| xtensor_adaptor<xbuffer_adaptor<std::remove_pointer_t<P>, O, A>, N, L> | ||
| xadapt(P& pointer, typename A::size_type size, O ownership, | ||
| const std::array<typename A::size_type, N>& shape, layout_type l = L, const A& alloc = A()); | ||
| const stat_shape<typename A::size_type, N>& shape, layout_type l = L, const A& alloc = A()); | ||
|
|
||
| /** | ||
| * Constructs an xtensor_adaptor of the given dynamically allocated C array, | ||
|
|
@@ -132,7 +132,7 @@ namespace xt | |
| template <class P, std::size_t N, class O, class A = std::allocator<std::remove_pointer_t<P>>> | ||
| xtensor_adaptor<xbuffer_adaptor<std::remove_pointer_t<P>, O, A>, N, layout_type::dynamic> | ||
| xadapt(P& pointer, typename A::size_type size, O ownership, | ||
| const std::array<typename A::size_type, N>& shape, const std::array<typename A::size_type, N>& strides, const A& alloc = A()); | ||
| const stat_shape<typename A::size_type, N>& shape, const stat_shape<typename A::size_type, N>& strides, const A& alloc = A()); | ||
|
|
||
| /***************************************** | ||
| * xarray_adaptor builder implementation * | ||
|
|
@@ -176,22 +176,22 @@ namespace xt | |
|
|
||
| template <class C, std::size_t N, layout_type L> | ||
| inline xtensor_adaptor<C, N, L> | ||
| xadapt(C& container, const std::array<typename C::size_type, N>& shape, layout_type l) | ||
| xadapt(C& container, const stat_shape<typename C::size_type, N>& shape, layout_type l) | ||
| { | ||
| return xtensor_adaptor<C, N, L>(container, shape, l); | ||
| } | ||
|
|
||
| template <class C, std::size_t N> | ||
| inline xtensor_adaptor<C, N, layout_type::dynamic> | ||
| xadapt(C& container, const std::array<typename C::size_type, N>& shape, const std::array<typename C::size_type, N>& strides) | ||
| xadapt(C& container, const stat_shape<typename C::size_type, N>& shape, const stat_shape<typename C::size_type, N>& strides) | ||
| { | ||
| return xtensor_adaptor<C, N, layout_type::dynamic>(container, shape, strides); | ||
| } | ||
|
|
||
| template <class P, std::size_t N, class O, layout_type L, class A> | ||
| inline xtensor_adaptor<xbuffer_adaptor<std::remove_pointer_t<P>, O, A>, N, L> | ||
| xadapt(P& pointer, typename A::size_type size, O, | ||
| const std::array<typename A::size_type, N>& shape, layout_type l, const A& alloc) | ||
| const stat_shape<typename A::size_type, N>& shape, layout_type l, const A& alloc) | ||
| { | ||
| using buffer_type = xbuffer_adaptor<std::remove_pointer_t<P>, O, A>; | ||
| buffer_type buf(pointer, size, alloc); | ||
|
|
@@ -201,7 +201,7 @@ namespace xt | |
| template <class P, std::size_t N, class O, class A> | ||
| inline xtensor_adaptor<xbuffer_adaptor<std::remove_pointer_t<P>, O, A>, N, layout_type::dynamic> | ||
| xadapt(P& pointer, typename A::size_type size, O, | ||
| const std::array<typename A::size_type, N>& shape, const std::array<typename A::size_type, N>& strides, const A& alloc) | ||
| const stat_shape<typename A::size_type, N>& shape, const stat_shape<typename A::size_type, N>& strides, const A& alloc) | ||
| { | ||
| using buffer_type = xbuffer_adaptor<std::remove_pointer_t<P>, O, A>; | ||
| buffer_type buf(pointer, size, alloc); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh, I can't comment on the lines above, but there is still a
std::enable_if_t<!detail::is_array<SC>::value... which obviously should be replaced. Maybe we can have something likedetail::is_static_containerordetail::is_static_size?This currently prevents building of the xadapt tests with GCC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I just discovered your new overload further down. Unfortunately it doesn't seem to be picked up. I'd love to investigate more, but lack the time (it's on Ubuntu 16.04 / GCC 5.4).