Hi - first post here, so I hope this question is okay, and isn't outside the scope of this forum. I'm trying to translate this to Rust (CppLowess/Lowess.h at master · hroest/CppLowess · GitHub). It's been going okay I think so far. Then I came across this snippet:
size_t m1 = n / 2; // Use nth element to find element m1, which produces a partially sorted // vector. This means we can get element m2 by looking for the maximum in the // remainder. typename ContainerType::iterator it_m1 = resid_weights.begin() + m1; std::nth_element(resid_weights.begin(), it_m1, resid_weights.end()); typename ContainerType::iterator it_m2 = std::max_element(resid_weights.begin(), it_m1);
Which uses a combination of nth_element & max_element. The variables which are important downstream are it_m1 and it_m2. I'm tying myself in knots trying to understand this. I think Rust iterators must be pretty different to C++ ones...
Any help greatly appreciated.