Skip to content

Commit

Permalink
ran pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Hubley committed Jul 11, 2024
1 parent 1d895e3 commit 6bf6a68
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
24 changes: 13 additions & 11 deletions include/xtensor/xstrided_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace xt
using iterator = typename C::iterator;
};

template<typename C>
template <typename C>
struct get_linear_iterator<C, void_t<decltype(std::declval<C>().linear_begin())>> : std::true_type
{
using iterator = typename C::linear_iterator;
Expand All @@ -172,7 +172,7 @@ namespace xt
using iterator = typename C::const_iterator;
};

template<typename C>
template <typename C>
struct get_const_linear_iterator<C, void_t<decltype(std::declval<C>().linear_cbegin())>> : std::true_type
{
using iterator = typename C::const_linear_iterator;
Expand All @@ -181,7 +181,8 @@ namespace xt
using linear_iterator = typename get_linear_iterator<storage_type>::iterator;
using const_linear_iterator = typename get_const_linear_iterator<storage_type>::iterator;
using reverse_linear_iterator = std::reverse_iterator<typename get_linear_iterator<storage_type>::iterator>;
using const_reverse_linear_iterator = std::reverse_iterator<typename get_const_linear_iterator<storage_type>::iterator>;
using const_reverse_linear_iterator = std::reverse_iterator<
typename get_const_linear_iterator<storage_type>::iterator>;

using iterable_base = select_iterable_base_t<L, xexpression_type::static_layout, self_type>;
using inner_shape_type = typename base_type::inner_shape_type;
Expand Down Expand Up @@ -538,14 +539,15 @@ namespace xt
inline auto xstrided_view<CT, S, L, FST>::linear_cbegin() const -> const_linear_iterator
{
return xtl::mpl::static_if<get_const_linear_iterator<storage_type>::value>(
[&](auto self)
{
return self(this->storage()).linear_cbegin() + static_cast<std::ptrdiff_t>(data_offset());
},
[&](auto self)
{
return self(this->storage()).cbegin() + static_cast<std::ptrdiff_t>(data_offset());
});
[&](auto self)
{
return self(this->storage()).linear_cbegin() + static_cast<std::ptrdiff_t>(data_offset());
},
[&](auto self)
{
return self(this->storage()).cbegin() + static_cast<std::ptrdiff_t>(data_offset());
}
);
}

template <class CT, class S, layout_type L, class FST>
Expand Down
30 changes: 15 additions & 15 deletions include/xtensor/xstrided_view_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ namespace xt

using linear_iterator = decltype(std::declval<std::remove_reference_t<CT>>().linear_begin());
using const_linear_iterator = decltype(std::declval<std::decay_t<CT>>().linear_cbegin());
using reverse_linear_iterator = decltype(std::declval<std::remove_reference_t<CT>>().linear_rbegin());
using reverse_linear_iterator = decltype(std::declval<std::remove_reference_t<CT>>().linear_rbegin()
);
using const_reverse_linear_iterator = decltype(std::declval<std::decay_t<CT>>().linear_crbegin());


Expand Down Expand Up @@ -134,7 +135,6 @@ namespace xt
template <class T>
struct is_linear_flat_expression_adaptor : std::false_type
{

};

template <class CT, layout_type L>
Expand All @@ -143,10 +143,11 @@ namespace xt
};

template <class E, class ST>
struct provides_data_interface
: xtl::conjunction<has_data_interface<std::decay_t<E>>, xtl::negation<is_flat_expression_adaptor<ST>>, xtl::negation<is_linear_flat_expression_adaptor<ST>>>
struct provides_data_interface : xtl::conjunction<
has_data_interface<std::decay_t<E>>,
xtl::negation<is_flat_expression_adaptor<ST>>,
xtl::negation<is_linear_flat_expression_adaptor<ST>>>
{

};
}

Expand Down Expand Up @@ -304,9 +305,10 @@ namespace xt
template <class CT, layout_type L, bool force = true>
struct flat_adaptor_getter
{
using type = std::conditional_t<detail::has_linear_iterator<std::remove_reference_t<CT>>::value && !force,
linear_flat_expression_adaptor<std::remove_reference_t<CT>, L>,
flat_expression_adaptor<std::remove_reference_t<CT>, L>>;
using type = std::conditional_t<
detail::has_linear_iterator<std::remove_reference_t<CT>>::value && !force,
linear_flat_expression_adaptor<std::remove_reference_t<CT>, L>,
flat_expression_adaptor<std::remove_reference_t<CT>, L>>;
using reference = std::add_lvalue_reference_t<CT>;

template <class E>
Expand Down Expand Up @@ -635,7 +637,7 @@ namespace xt
*/
template <class D>
inline auto xstrided_view_base<D>::storage() const noexcept -> const storage_type&
{
{
return m_storage;
}

Expand Down Expand Up @@ -850,22 +852,20 @@ namespace xt
return index;
}

template <class CT, layout_type L>
template <class CT, layout_type L>
inline linear_flat_expression_adaptor<CT, L>::linear_flat_expression_adaptor(CT* e)
:
flat_expression_adaptor<CT,L>(e),
m_e(e)
: flat_expression_adaptor<CT, L>(e)
, m_e(e)
{
}

template <class CT, layout_type L>
template <class FST>
inline linear_flat_expression_adaptor<CT, L>::linear_flat_expression_adaptor(CT* e, FST&& strides)
: flat_expression_adaptor<CT, L>(e, strides)
: flat_expression_adaptor<CT, L>(e, strides)
, m_e(e)
, m_strides(xtl::forward_sequence<inner_strides_type, FST>(strides))
{

}

template <class CT, layout_type L>
Expand Down

0 comments on commit 6bf6a68

Please sign in to comment.