-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
I tried coding this to find max_element using a binary search:
template<typename flt_t>
flt_t max_element2 (nd::Array<flt_t,1,1> const& in) {
if (boost::size(in) == 1)
return in[0];
else {
flt_t a = max_element2 (in[nd::view(0,boost::size(in)/2)]);
flt_t b = max_element2 (in[nd::view(boost::size(in)/2)()]);
return std::max (a, b);
}
}
But it doesn't compile, because the recursive call passing a view doesn't match the function sig. I also tried ArrayRef, but same result. What is the correct way to code this?
Metadata
Metadata
Assignees
Labels
No labels