@@ -700,13 +700,16 @@ template <
700700 typename Projection = std::identity
701701>
702702 requires std::sortable<Iterator, Compare, Projection>
703- void timmerge (Iterator first, Iterator middle, Sentinel last,
704- Compare comp={}, Projection proj={}) {
703+ auto timmerge (Iterator first, Iterator middle, Sentinel last,
704+ Compare comp={}, Projection proj={})
705+ -> Iterator
706+ {
705707 auto last_it = std::ranges::next (first, last);
706708 GFX_TIMSORT_AUDIT (std::is_sorted (first, middle, comp, proj) && " Precondition" );
707709 GFX_TIMSORT_AUDIT (std::is_sorted (middle, last_it, comp, proj) && " Precondition" );
708710 detail::TimSort<Iterator, Compare, Projection>::merge (first, middle, last_it, comp, proj);
709711 GFX_TIMSORT_AUDIT (std::is_sorted (first, last_it, comp, proj) && " Postcondition" );
712+ return last_it;
710713}
711714
712715/* *
@@ -719,10 +722,11 @@ template <
719722 typename Projection = std::identity
720723>
721724 requires std::sortable<std::ranges::iterator_t <Range>, Compare, Projection>
722- void timmerge (Range &&range, std::ranges::iterator_t <Range> middle,
725+ auto timmerge (Range &&range, std::ranges::iterator_t <Range> middle,
723726 Compare comp={}, Projection proj={})
727+ -> std::ranges::borrowed_iterator_t<Range>
724728{
725- gfx::timmerge (std::begin (range), middle, std::end (range), comp, proj);
729+ return gfx::timmerge (std::begin (range), middle, std::end (range), comp, proj);
726730}
727731
728732/* *
@@ -735,11 +739,14 @@ template <
735739 typename Projection = std::identity
736740>
737741 requires std::sortable<Iterator, Compare, Projection>
738- void timsort (Iterator first, Sentinel last,
739- Compare comp={}, Projection proj={}) {
742+ auto timsort (Iterator first, Sentinel last,
743+ Compare comp={}, Projection proj={})
744+ -> Iterator
745+ {
740746 auto last_it = std::ranges::next (first, last);
741747 detail::TimSort<Iterator, Compare, Projection>::sort (first, last_it, comp, proj);
742748 GFX_TIMSORT_AUDIT (std::is_sorted (first, last_it, comp, proj) && " Postcondition" );
749+ return last_it;
743750}
744751
745752/* *
@@ -751,8 +758,10 @@ template <
751758 typename Projection = std::identity
752759>
753760 requires std::sortable<std::ranges::iterator_t <Range>, Compare, Projection>
754- void timsort (Range &&range, Compare comp={}, Projection proj={}) {
755- gfx::timsort (std::begin (range), std::end (range), comp, proj);
761+ auto timsort (Range &&range, Compare comp={}, Projection proj={})
762+ -> std::ranges::borrowed_iterator_t<Range>
763+ {
764+ return gfx::timsort (std::begin (range), std::end (range), comp, proj);
756765}
757766
758767} // namespace gfx
0 commit comments