Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/xtensor/containers/xarray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ namespace xt
xarray_adaptor& operator=(const xexpression<E>& e);

template <class P, class S>
void reset_buffer(P&& pointer, S&& size);
void reset_buffer(P&& buffer, S&& size);

private:

Expand Down Expand Up @@ -657,9 +657,9 @@ namespace xt

template <class EC, layout_type L, class SC, class Tag>
template <class P, class S>
inline void xarray_adaptor<EC, L, SC, Tag>::reset_buffer(P&& pointer, S&& size)
inline void xarray_adaptor<EC, L, SC, Tag>::reset_buffer(P&& buffer, S&& size)
{
return m_storage.reset_data(std::forward<P>(pointer), std::forward<S>(size));
return m_storage.reset_data(std::forward<P>(buffer), std::forward<S>(size));
}
}

Expand Down
6 changes: 3 additions & 3 deletions include/xtensor/containers/xtensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace xt
xtensor_adaptor& operator=(const xexpression<E>& e);

template <class P, class S>
void reset_buffer(P&& pointer, S&& size);
void reset_buffer(P&& buffer, S&& size);

private:

Expand Down Expand Up @@ -720,9 +720,9 @@ namespace xt

template <class EC, std::size_t N, layout_type L, class Tag>
template <class P, class S>
inline void xtensor_adaptor<EC, N, L, Tag>::reset_buffer(P&& pointer, S&& size)
inline void xtensor_adaptor<EC, N, L, Tag>::reset_buffer(P&& buffer, S&& size)
{
return m_storage.reset_data(std::forward<P>(pointer), std::forward<S>(size));
return m_storage.reset_data(std::forward<P>(buffer), std::forward<S>(size));
}

/*******************************
Expand Down
2 changes: 1 addition & 1 deletion include/xtensor/core/xshape.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ namespace xt
};

template <class R, class U, std::size_t... I>
constexpr R initializer_shape(U t, std::index_sequence<I...>)
constexpr R initializer_shape([[maybe_unused]] U t, std::index_sequence<I...>)
{
using size_type = typename R::value_type;
return {size_type(initializer_shape_impl<I>::value(t))...};
Expand Down
10 changes: 5 additions & 5 deletions include/xtensor/io/xio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ namespace xt
using cache_type = std::vector<value_type>;
using cache_iterator = typename cache_type::const_iterator;

explicit printer(std::streamsize precision)
: m_precision(precision)
explicit printer(std::streamsize max_precision)
: m_precision(max_precision)
{
}

Expand Down Expand Up @@ -554,9 +554,9 @@ namespace xt
using cache_type = std::vector<bool>;
using cache_iterator = typename cache_type::const_iterator;

explicit printer(std::streamsize precision)
: real_printer(precision)
, imag_printer(precision)
explicit printer(std::streamsize max_precision)
: real_printer(max_precision)
, imag_printer(max_precision)
{
}

Expand Down
5 changes: 1 addition & 4 deletions include/xtensor/misc/xsort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ namespace xt
template <class ConstRandomIt, class RandomIt, class Compare, class Method>
inline void argsort_iter(
ConstRandomIt data_begin,
ConstRandomIt data_end,
[[maybe_unused]] ConstRandomIt data_end,
RandomIt idx_begin,
RandomIt idx_end,
Compare comp,
Expand All @@ -303,7 +303,6 @@ namespace xt
{
XTENSOR_ASSERT(std::distance(data_begin, data_end) >= 0);
XTENSOR_ASSERT(std::distance(idx_begin, idx_end) == std::distance(data_begin, data_end));
(void) idx_end; // TODO(C++17) [[maybe_unused]] only used in assertion.

std::iota(idx_begin, idx_end, 0);
switch (method)
Expand Down Expand Up @@ -1237,7 +1236,6 @@ namespace xt
template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL, class E>
inline auto argmin(const xexpression<E>& e)
{
using value_type = typename E::value_type;
auto&& ed = eval(e.derived_cast());
auto begin = ed.template begin<L>();
auto end = ed.template end<L>();
Expand Down Expand Up @@ -1267,7 +1265,6 @@ namespace xt
template <layout_type L = XTENSOR_DEFAULT_TRAVERSAL, class E>
inline auto argmax(const xexpression<E>& e)
{
using value_type = typename E::value_type;
auto&& ed = eval(e.derived_cast());
auto begin = ed.template begin<L>();
auto end = ed.template end<L>();
Expand Down
3 changes: 1 addition & 2 deletions include/xtensor/optional/xoptional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ namespace xt
template <class U, class... Args>
constexpr result_type apply_impl(const U& t, const Args&... args) const
{
return t & apply_impl(args...);
return t && apply_impl(args...);
}

template <class B>
Expand Down Expand Up @@ -242,7 +242,6 @@ namespace xt
struct xreducer_temporary_type<xtl::xoptional<T, B>>
{
using type = xtl::xoptional<std::decay_t<T>, bool>;
;
};
}

Expand Down
8 changes: 4 additions & 4 deletions include/xtensor/reducers/xreducer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ namespace xt
inline auto xreducer<F, CT, X, O>::element(It first, It last) const -> const_reference
{
XTENSOR_TRY(check_element_index(shape(), first, last));
auto stepper = const_stepper(*this, 0);
auto reducer_stepper = const_stepper(*this, 0);
if (first != last)
{
size_type dim = 0;
Expand All @@ -1563,16 +1563,16 @@ namespace xt
{
if (begin < first)
{
stepper.step(dim++, std::size_t(0));
reducer_stepper.step(dim++, std::size_t(0));
begin++;
}
else
{
stepper.step(dim++, std::size_t(*begin++));
reducer_stepper.step(dim++, std::size_t(*begin++));
}
}
}
return *stepper;
return *reducer_stepper;
}

/**
Expand Down
23 changes: 12 additions & 11 deletions include/xtensor/utils/xexception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,17 +310,18 @@ namespace xt

#if (defined(XTENSOR_ENABLE_ASSERT) && !defined(XTENSOR_DISABLE_EXCEPTIONS))
#define XTENSOR_TRY(expr) XTENSOR_TRY_IMPL(expr, __FILE__, __LINE__)
#define XTENSOR_TRY_IMPL(expr, file, line) \
try \
{ \
expr; \
} \
catch (std::exception & e) \
{ \
XTENSOR_THROW( \
std::runtime_error, \
std::string(file) + ':' + std::to_string(line) + ": check failed\n\t" + std::string(e.what()) \
); \
#define XTENSOR_TRY_IMPL(expr, file, line) \
try \
{ \
expr; \
} \
catch (std::exception & xtensor_check_error) \
{ \
XTENSOR_THROW( \
std::runtime_error, \
std::string(file) + ':' + std::to_string(line) + ": check failed\n\t" \
+ std::string(xtensor_check_error.what()) \
); \
}
#else
#define XTENSOR_TRY(expr)
Expand Down
6 changes: 1 addition & 5 deletions include/xtensor/utils/xutils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,7 @@ namespace xt
)
{
R res = init;
auto wrapper = [&](const auto& i, const auto& j)
{
res = f(i, j);
};
(wrapper(res, std::get<I>(t)), ...);
((res = f(res, std::get<I>(t))), ...);
return res;
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/xtensor/views/index_mapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace xt
{

template <class UndefinedView>
struct index_mapper;
class index_mapper;

/**
* @enum access_t
Expand Down
39 changes: 20 additions & 19 deletions include/xtensor/views/xdynamic_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ namespace xt
template <class CTA, class SA>
xdynamic_view(
CTA&& e,
SA&& shape,
get_strides_t<S>&& strides,
SA&& view_shape,
get_strides_t<S>&& view_strides,
std::size_t offset,
layout_type layout,
layout_type view_layout,
slice_vector_type&& slices,
get_strides_t<S>&& adj_strides
) noexcept;
Expand Down Expand Up @@ -225,14 +225,14 @@ namespace xt
void fill(const T& value);

template <class ST>
stepper stepper_begin(const ST& shape);
stepper stepper_begin(const ST& iteration_shape);
template <class ST>
stepper stepper_end(const ST& shape, layout_type l);
stepper stepper_end(const ST& iteration_shape, layout_type l);

template <class ST>
const_stepper stepper_begin(const ST& shape) const;
const_stepper stepper_begin(const ST& iteration_shape) const;
template <class ST>
const_stepper stepper_end(const ST& shape, layout_type l) const;
const_stepper stepper_end(const ST& iteration_shape, layout_type l) const;

using container_iterator = std::
conditional_t<is_const, typename storage_type::const_iterator, typename storage_type::iterator>;
Expand Down Expand Up @@ -383,14 +383,14 @@ namespace xt
template <class CTA, class SA>
inline xdynamic_view<CT, S, L, FST>::xdynamic_view(
CTA&& e,
SA&& shape,
get_strides_t<S>&& strides,
SA&& view_shape,
get_strides_t<S>&& view_strides,
std::size_t offset,
layout_type layout,
layout_type view_layout,
slice_vector_type&& slices,
get_strides_t<S>&& adj_strides
) noexcept
: base_type(std::forward<CTA>(e), std::forward<SA>(shape), std::move(strides), offset, layout)
: base_type(std::forward<CTA>(e), std::forward<SA>(view_shape), std::move(view_strides), offset, view_layout)
, m_slices(std::move(slices))
, m_adj_strides(std::move(adj_strides))
{
Expand Down Expand Up @@ -525,34 +525,35 @@ namespace xt

template <class CT, class S, layout_type L, class FST>
template <class ST>
inline auto xdynamic_view<CT, S, L, FST>::stepper_begin(const ST& shape) -> stepper
inline auto xdynamic_view<CT, S, L, FST>::stepper_begin(const ST& iteration_shape) -> stepper
{
size_type offset = shape.size() - dimension();
size_type offset = iteration_shape.size() - dimension();
return stepper(this, offset);
}

template <class CT, class S, layout_type L, class FST>
template <class ST>
inline auto xdynamic_view<CT, S, L, FST>::stepper_end(const ST& shape, layout_type /*l*/) -> stepper
inline auto xdynamic_view<CT, S, L, FST>::stepper_end(const ST& iteration_shape, layout_type /*l*/)
-> stepper
{
size_type offset = shape.size() - dimension();
size_type offset = iteration_shape.size() - dimension();
return stepper(this, offset, true);
}

template <class CT, class S, layout_type L, class FST>
template <class ST>
inline auto xdynamic_view<CT, S, L, FST>::stepper_begin(const ST& shape) const -> const_stepper
inline auto xdynamic_view<CT, S, L, FST>::stepper_begin(const ST& iteration_shape) const -> const_stepper
{
size_type offset = shape.size() - dimension();
size_type offset = iteration_shape.size() - dimension();
return const_stepper(this, offset);
}

template <class CT, class S, layout_type L, class FST>
template <class ST>
inline auto xdynamic_view<CT, S, L, FST>::stepper_end(const ST& shape, layout_type /*l*/) const
inline auto xdynamic_view<CT, S, L, FST>::stepper_end(const ST& iteration_shape, layout_type /*l*/) const
-> const_stepper
{
size_type offset = shape.size() - dimension();
size_type offset = iteration_shape.size() - dimension();
return const_stepper(this, offset, true);
}

Expand Down
8 changes: 4 additions & 4 deletions include/xtensor/views/xslice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1301,9 +1301,9 @@ namespace xt
t.begin(),
t.end(),
m_raw_indices.begin(),
[](auto t)
[](auto index)
{
return static_cast<size_type>(t);
return static_cast<size_type>(index);
}
);
}
Expand Down Expand Up @@ -1445,9 +1445,9 @@ namespace xt
t.begin(),
t.end(),
m_raw_indices.begin(),
[](auto t)
[](auto index)
{
return static_cast<size_type>(t);
return static_cast<size_type>(index);
}
);
}
Expand Down
Loading
Loading