81 std::size_t size = range.size();
82 std::size_t medianPos = (size+1)/2;
83 auto medianIter = boost::begin(range)+medianPos;
85 std::nth_element(range.begin(),medianIter, range.end());
106 auto begin = range.begin();
107 auto end = range.end();
112 auto median = *medianIter;
113 typedef typename Range::const_reference const_ref;
114 auto left = std::partition(begin,medianIter,[&](const_ref elem){
return elem < median;});
115 auto right = std::partition(medianIter,end,[&](const_ref elem){
return elem == median;});
123 if (left - begin >= end - right)