Skip to content

Commit eb59637

Browse files
committed
Using std for argmin and argmax where possible
1 parent b2e23d0 commit eb59637

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

include/xtensor/xsort.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,10 @@ namespace xt
857857
{
858858
using value_type = typename E::value_type;
859859
auto&& ed = eval(e.derived_cast());
860-
return detail::arg_func_impl<L>(ed, std::less<value_type>());
860+
auto begin = ed.template begin<L>();
861+
auto end = ed.template end<L>();
862+
std::size_t i = std::distance(begin, std::min_element(begin, end));
863+
return xtensor<size_t, 0>{i};
861864
}
862865

863866
/**
@@ -884,7 +887,10 @@ namespace xt
884887
{
885888
using value_type = typename E::value_type;
886889
auto&& ed = eval(e.derived_cast());
887-
return detail::arg_func_impl<L>(ed, std::greater<value_type>());
890+
auto begin = ed.template begin<L>();
891+
auto end = ed.template end<L>();
892+
std::size_t i = std::distance(begin, std::max_element(begin, end));
893+
return xtensor<size_t, 0>{i};
888894
}
889895

890896
/**

0 commit comments

Comments
 (0)