Median calculation of a vector of T.

That's correct David.
 We had to use partial_sort for gcc version < 4.8.3

On Thu, Nov 13, 2014 at 11:03 AM, David Irvine <notifications@github.com>
wrote:

> In include/maidsafe/common/utils.h:
>
> > @@ -229,6 +229,19 @@ bool IsReady(std::future<T>& future) {
> >    return future.wait_for(std::chrono::seconds::zero()) == std::future_status::ready;
> >  }
> >
> > +template <typename T>
> > +T Median(std::vector<T>& values)  {
> > +  size_t size(values.size());
> > +  auto it(values.begin() + size / 2);
> > +  std::nth_element(values.begin(), it, values.end());
>
> I think this algorithm (nth_element) does not work in gcc 4.8.3, if I
> remember correctly Mahmoud had to use a work around for this in routing.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/maidsafe/MaidSafe-Common/pull/68/files#r20283872>.
>



-- 
Regards,
Mahmoud

maidsafe.net Limited is a limited liability company incorporated in
Scotland with number SC297540. VAT Registered 889 0608 77. Registered
Office: 72 Templehill, Troon, KA10 6BE.
Telephone Scotland: +44 1292 750020.