-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove cppsort::sort and cppsort::stable_sort #167
Comments
cppsort::sort and cppsort::stable_sort are deprecated and will be removed in version 2.0.0. This commit drastically reduces their use in the test suite and only keep them where they are specifically tested because they're relevant. This should also reduce the parsing time of the test suite: since the header drags default_sorter along the way it tends to be heavy for tests where a single sorter is needed. This commit also fixes a few minor style issues or include issues that were hidden by transitive includes along the way.
After more adjustments and backports applied to the 1.x.y branch in 65d43bc, I think that we are finally done with this. Bye bye |
cppsort::sort
cppsort::sort
doesn't add much value to the library: it is dead simple to use but it just morphssorter(...)
into the longercppsort::sort(sorter, ...)
and has a bunch of drawbacks that even the documentation acknowledges:It basically worsens the compile times, worsens the error messages, adds additional layers of SFINAE that shouldn't be, doesn't have the benefit of function objects, and doesn't offer anything significant advantage for its cost. Also it takes the sorter by
const&
which means that it won't play nice with mutable sorters (#104) once they are implemented. Its only redeeming quality is that it hidesdefault_sorter
when it is not given a specific sorter, butdefault_sorter
itself should probably be nuked (TODO: new issue).The use of
cppsort::sort
in many places in the test suite is probably something that slows down the compilation for little benefit, which is a bit of a shame when we are trying to reduce compile times (#125). We also strive to make error messages more readable (#28) so it becomes difficult to justify the existence ofcppsort::sort
.In 2.0.0 there won't be a simple
sort()
function name available in namespacecppsort::
anymore so we might be able to simplify the implementation of the ADL tricks incontainer_aware_adapter
a bit.cppsort::stable_sort
cppsort::stable_sort
is barely better: it provides a known interface when coming from the standard library, but all it does is to hidestable_adapter
. While it might make the library easier to use for very beginners, this library is supposed to be used by people who want to experiment with sorting algorithms and adapters: those are the core concepts of the library so hiding them makes little sense since people who actually want to use the library will be exposed to it very soon anyway.Moreover using
stable_adapter
became way easier since CTAD was introduced in C++17 - since 2.0.0 will be C++20 only this will be entirely sufficient:auto stable_pdq_sort = stable_adapter(pdq_sort);
cppsort::stable_sort
also suffers from all the same issues ascppsort::sort
, but manages to be even worse with regard to mutable sorters as highlighted in the documentation:What to do
Here is the plan for cpp-sort 2.0.0:
cppsort::sort
cppsort::stable_sort
container_aware_adapter
to not rely oncppsort::sort
anymorecontainer_aware_adapter
in 2.0.0 if possible[[deprecated]]
in branch 1.x (+ option to kill the warning)cppsort::sort
in the test suite where it's not relevant in 1.xThe text was updated successfully, but these errors were encountered: