diff --git a/TinySTL/Algorithm.h b/TinySTL/Algorithm.h index 858dc10..b2c71ec 100644 --- a/TinySTL/Algorithm.h +++ b/TinySTL/Algorithm.h @@ -144,9 +144,16 @@ namespace TinySTL{ } //********* [sort_heap] *************** template - void sort_heap(RandomAccessIterator first, RandomAccessIterator last); + void sort_heap(RandomAccessIterator first, RandomAccessIterator last){ + return TinySTL::sort_heap(first, last, + TinySTL::less::value_type>()); + } template - void sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + void sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp){ + for (auto cur = last; cur != first; --cur){ + TinySTL::pop_heap(first, cur, comp); + } + } //********* [is_heap] *************** template bool is_heap(RandomAccessIterator first, RandomAccessIterator last){