lemon/radix_sort.h
changeset 1948 9e9c035a08be
parent 1875 98698b69a902
child 1956 a055123339d5
equal deleted inserted replaced
2:a09a20863205 3:12586086f1d9
   315   }
   315   }
   316 
   316 
   317   
   317   
   318   template <typename Value, typename Iterator, typename Functor>
   318   template <typename Value, typename Iterator, typename Functor>
   319   void counterSignedSort(Iterator first, Iterator last, Functor functor) {
   319   void counterSignedSort(Iterator first, Iterator last, Functor functor) {
       
   320     if (first == last) return;
   320     typedef typename std::iterator_traits<Iterator>::value_type Key;
   321     typedef typename std::iterator_traits<Iterator>::value_type Key;
   321     typedef std::allocator<Key> Allocator;
   322     typedef std::allocator<Key> Allocator;
   322     Allocator allocator;
   323     Allocator allocator;
   323 
   324 
   324     int length = std::distance(first, last);
   325     int length = std::distance(first, last);
   353     allocator.deallocate(buffer, 2 * length);
   354     allocator.deallocate(buffer, 2 * length);
   354   }
   355   }
   355 
   356 
   356   template <typename Value, typename Iterator, typename Functor>
   357   template <typename Value, typename Iterator, typename Functor>
   357   void counterUnsignedSort(Iterator first, Iterator last, Functor functor) {
   358   void counterUnsignedSort(Iterator first, Iterator last, Functor functor) {
       
   359     if (first == last) return;
   358     typedef typename std::iterator_traits<Iterator>::value_type Key;
   360     typedef typename std::iterator_traits<Iterator>::value_type Key;
   359     typedef std::allocator<Key> Allocator;
   361     typedef std::allocator<Key> Allocator;
   360     Allocator allocator;
   362     Allocator allocator;
   361 
   363 
   362     int length = std::distance(first, last);
   364     int length = std::distance(first, last);