MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / try_argsort

Function try_argsort

include/stringzilla/stringzilla.hpp:4676–4691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4674 */
4675template <typename container_type_, typename string_extractor_>
4676status_t try_argsort(container_type_ const &container, string_extractor_ const &extractor,
4677 sorted_idx_t *order) noexcept {
4678
4679 // Pack the arguments into a single structure to reference it from the callback.
4680 using args_t = sequence_args_<container_type_, string_extractor_>;
4681 args_t args {container, extractor};
4682 sz_sequence_t sequence;
4683 sequence.handle = &args;
4684 sequence.count = container.size();
4685 sequence.get_start = call_sequence_member_start_<container_type_, string_extractor_>;
4686 sequence.get_length = call_sequence_member_length_<container_type_, string_extractor_>;
4687
4688 using sz_alloc_type = sz_memory_allocator_t;
4689 return _with_alloc<std::allocator<sz_u8_t>>(
4690 [&](sz_alloc_type &alloc) { return sz_sequence_argsort(&sequence, &alloc, order); });
4691}
4692
4693/**
4694 * @brief Locates the positions of the elements in 2 deduplicated string arrays that have identical values.

Callers 1

argsortFunction · 0.85

Calls 2

sz_sequence_argsortFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…