Skip to content

Commit f49d573

Browse files
authored
Merge pull request #2502 from JohanMabille/cleanup
Removed unused code
2 parents 1ef6192 + c8e310c commit f49d573

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

include/xtensor/xsort.hpp

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -768,31 +768,6 @@ namespace xt
768768
using type = xtensor<std::size_t, N - 1>;
769769
};
770770

771-
template <class IT, class F>
772-
inline xtensor<std::size_t, 0> cmp_idx(IT iter, IT end, std::ptrdiff_t inc, F&& cmp)
773-
{
774-
std::size_t idx = 0;
775-
auto min = *iter;
776-
iter += inc;
777-
for (std::size_t i = 1; iter < end; iter += inc, ++i)
778-
{
779-
if (cmp(*iter, min))
780-
{
781-
min = *iter;
782-
idx = i;
783-
}
784-
}
785-
return xtensor<std::size_t, 0>{idx};
786-
}
787-
788-
template <layout_type L, class E, class F>
789-
inline xtensor<std::size_t, 0> arg_func_impl(const E& e, F&& f)
790-
{
791-
return cmp_idx(e.template begin<L>(),
792-
e.template end<L>(), 1,
793-
std::forward<F>(f));
794-
}
795-
796771
template <layout_type L, class E, class F>
797772
inline typename argfunc_result_type<E>::type
798773
arg_func_impl(const E& e, std::size_t axis, F&& cmp)
@@ -804,7 +779,10 @@ namespace xt
804779

805780
if (e.dimension() == 1)
806781
{
807-
return arg_func_impl<L>(e, std::forward<F>(cmp));
782+
auto begin = e.template begin<L>();
783+
auto end = e.template end<L>();
784+
std::size_t i = std::distance(begin, std::min_element(begin, end));
785+
return xtensor<size_t, 0>{i};
808786
}
809787

810788
result_shape_type alt_shape;

0 commit comments

Comments
 (0)