adaptive: use std::unique_ptr and auto when possible
Draft because depends it might depends on !1615 (merged), and I still have a few things to check.
It uses auto to simplify the iterator type, easing the transition from vector<Segment*>::iterator
to vector<unique_ptr<T>>::iterator
, while also removing iterators from the loops.
It then change the vector to use unique_ptr, making a clear ownership signal and ensuring there is no leaks of segments.
Note that among the auto use, it uses auto
as a lambda parameter which is C++14.