Skip to content

Commit 6b52687

Browse files
Document the function arguments of stable_counting_sort instead of its template parameters
1 parent 68582ba commit 6b52687

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

libs/libvtrutil/src/vtr_sort.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ namespace vtr {
4040
* as uint32_t to halve the memory traffic of the counts array, which is
4141
* accessed randomly in the placement pass.
4242
*
43-
* @tparam InIt Forward iterator over the input elements.
44-
* @tparam OutIt Random access iterator to the output range.
45-
* @tparam KeyFn Callable mapping an element to its key. The key may be any
46-
* type explicitly convertible to size_t (integers, vtr::StrongId).
43+
* @param first Forward iterator to the first input element.
44+
* @param last Forward iterator one past the last input element.
45+
* @param out Random access iterator to the output range, which must
46+
* already have room for (last - first) elements.
4747
* @param num_keys Exclusive upper bound on the keys. Every key must be smaller than this.
48+
* @param key_of Callable mapping an element to its key. The key may be any
49+
* type explicitly convertible to size_t (integers, enums, vtr::StrongId).
4850
*/
4951
template<typename InIt, typename OutIt, typename KeyFn>
5052
requires std::forward_iterator<InIt> && std::random_access_iterator<OutIt>
@@ -98,8 +100,10 @@ void stable_counting_sort(InIt first, InIt last, OutIt out, size_t num_keys, Key
98100
* as the destination buffer and then swapped with items, so after the call
99101
* scratch holds the old (unsorted) contents.
100102
*
101-
* @tparam Container Random access, swappable container (std::vector, vtr::vector, ...).
103+
* @param items Random access, swappable container (std::vector, vtr::vector, ...) to sort.
104+
* @param scratch Container of the same type and size as items, used as the destination buffer.
102105
* @param num_keys Exclusive upper bound on the keys. Every key must be smaller than this.
106+
* @param key_of Callable mapping an element to its key.
103107
*/
104108
template<typename Container, typename KeyFn>
105109
void stable_counting_sort(Container& items, Container& scratch, size_t num_keys, KeyFn key_of) {

0 commit comments

Comments
 (0)