1.7.0 — Flowers
I spent a great deal of time during the recent confinement identifying flowers and other plants in my garden, and I also learnt to cook some of them. I was left with a a few hundred plant pictures on my phone and decided to start a tiny glitch art side project with some of the flower photos. With all those flowery endeavours behind me, it was time to come back with a fresh cpp-sort release.
New features
Chainable projections through operator|
have been implemented (issue #82), allowing to apply several transformations in a row when projecting a collection's element:
struct wrapper { int value; };
std::vector<wrapper> vec = { /* ... */ };
auto&& negate = cppsort::utility::as_projection(std::negate<>{});
// Applies &wrapper::value to the elements of vec, then negate
cppsort::split_sort(vec, &wrapper::value | negate);
The new operator|
only considers classes inheriting from cppsort::utility::projection_base
during overload resolutions. In order to make your own projections work with you can either make them inherit from projection_base
, or adapt them with cppsort::utility::as_projection
.
Improvements
- The speed of
merge_insertion_sort
has been improved (it remains an extremely slow algorithm):
The old implementation usedstd::list
internally, with eitherstd::allocator
or__gnu_cxx::bitmap_allocator
when available to improve the allocation speed. The new implementation uses a custom list data structure which performs a single allocation of all the nodes required by the algorithm. - Sorters and adapters now accept comparison functions that take their arguments by non-
const
reference, it is the responsibility of the caller to make sure that such predicates don't modify their parameters in a way that would affect the consistency of the sort (issue #136). Following the resolution of standard issue LWG3031 it is also the responsibility of the caller to ensure that, should the predicate accept bothconst
and non-const
parameters, the results are consistent between overloads. as_comparison
andas_projection
can now adapt any Callable, and not just objects callable with the normal function call syntax.- Fixed an integer conversion warning in
pdq_sort
(merged a fix from upstream). - Fixed a signed/unsigned warning in the measures of presortedness tests.
- Some compile time error stack traces might point directly into the cpp-sort algorithms instead of in standard library utilities, making them a bit shallower.
- Reduce the binary size of the code generated by
ska_sort
a bit.
Tooling
- CMake: Catch2 is now looked with
find_package
first, and only downloaded if no suitable version was found on the system. This notably allows to build the test suite while offline. - CMake: Catch2 is not required anymore to build the examples.
- Fix the conanfile.py so that it works with the most recent Conan versions.
- Small improvements to
bars.py
in the benchmarking tools.
Known bugs
I didn't manage to fix every bug I could find since the previous release, so you might want to check the list of known bugs.