This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, layout_type L = XTENSOR_DEFAULT_LAYOUT, | |
class A = std::allocator<T>> | |
class xarray | |
{ | |
public: | |
template <std::size_t I> | |
xarray(nested_initializer_list_t<value_type, I> t); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, std::size_t I> | |
struct nested_initializer_list | |
{ | |
using nested_type = | |
typename nested_initializer_list<T, I - 1>::type; | |
using type = std::initializer_list<nested_type>; | |
}; | |
template <class T> | |
struct nested_initializer_list<T, 0> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, layout_type L, class A> | |
xarray<T, L, A>::xarray(const shape_type& shape, layout_type l) | |
: xarray() | |
{ | |
resize(shape, layout); | |
} | |
template <class T, layout_type L, class A> | |
xarray<T, L, A>::xarray(const shape_type& shape, const_reference, | |
layout_type l) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, layout_type L = XTENSOR_DEFAULT_LAYOUT, | |
class A = std::allocator<T>> | |
class xarray | |
{ | |
public: | |
xarray() = default; | |
explicit xarray(const shape_type& shape, layout_type l = L); | |
explicit xarray(const shape_type& shape, const_reference value, | |
layout_type l = L); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, layout_type L = XTENSOR_DEFAULT_LAYOUT, | |
class A = std::allocator<T>> | |
class xarray | |
{ | |
public: | |
xarray() = default; | |
explicit xarray(const shape_type& shape, layout_type l = L); | |
explicit xarray(const shape_type& shape, | |
const strides_type& strides); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private: | |
shape_type m_shape; | |
strides_type m_strides; | |
storage_type m_storage; | |
layout_type m_layout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class St, class S, layout_type L> | |
inline auto xiterator<St, S, L>::operator++() -> self_type& | |
{ | |
stepper_tools<L>::increment_stepper(m_st, m_index, this->shape()); | |
return *this; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <layout_type L> | |
struct stepper_tools | |
{ | |
template <class S, class IT, class ST> | |
static void increment_stepper(S& stepper, | |
IT& index, | |
const ST& shape); | |
}; | |
template <> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class St, class S, layout_type L> | |
inline auto xiterator<St, S, L>::operator*() const -> reference | |
{ | |
return *m_st; | |
} | |
template <class St, class S, layout_type L> | |
inline auto xiterator<St, S, L>::operator->() const -> pointer | |
{ | |
return &(*m_st); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class St, class S, layout_type L> | |
class xiterator | |
{ | |
public: | |
using self_type = xiterator<St, S, L>; | |
using stepper_type = St; | |
using value_type = typename stepper_type::value_type; | |
using reference = typename stepper_type::reference; | |
using pointer = typename stepper_type::pointer; |