You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is actually a bit tricky considering that there's already iter_swap as a customization point which depends on the iterator type and swap on the value type. Even our own swap_if optimization in the library's internals is only applied when iter_swap isn't picked first. I guess that it would be possible to hijack that by wrapping some type somewhere in a dummy template to make sure that overload resolution picks swap(sorting_network_tag<T>&, sorting_network_tag<T>&); and that this overload calls the sorting function associated to the sorting network, but that's more templates, more random overload resolution and obscure customization points. It would also only work with stateless function types associated to the sorting network type, which is limited but should be enough for a compare-and-swap function.
The text was updated successfully, but these errors were encountered:
Papers like Engineering Faster Sorters for Small Sets of Items by Bingmann & al. and Applying Sorting Networks to Synthesize Optimized Sorting Libraries by Codish & al. highlight the need for cpp-sort to be able to parametrize sorting networks on their swapping function.
This is actually a bit tricky considering that there's already
iter_swap
as a customization point which depends on the iterator type andswap
on the value type. Even our ownswap_if
optimization in the library's internals is only applied wheniter_swap
isn't picked first. I guess that it would be possible to hijack that by wrapping some type somewhere in a dummy template to make sure that overload resolution picksswap(sorting_network_tag<T>&, sorting_network_tag<T>&);
and that this overload calls the sorting function associated to the sorting network, but that's more templates, more random overload resolution and obscure customization points. It would also only work with stateless function types associated to the sorting network type, which is limited but should be enough for a compare-and-swap function.The text was updated successfully, but these errors were encountered: