Skip to content
Morwenn edited this page Feb 17, 2018 · 26 revisions

Welcome to the cpp-sort wiki!

You probably read the introduction in the README, so I won't repeat it here. This wiki contains documentation about the library: basic documentation about the many sorting tools and how to use them, documentation about the additional utilities provided by the library and even some detailed tutorials if you ever want to write your own sorters or sorter adapters. This main page explains a few general things that I couldn't fit in other parts of the documentation.

Versioning

cpp-sort follows semantic versioning and provides the following macros in <cpp-sort/version.h> to check the current major, minor and patch versions:

CPPSORT_VERSION_MAJOR
CPPSORT_VERSION_MINOR
CPPSORT_VERSION_PATCH

Exception safety

Every library function provides the no-leak guarantee, which means that all the memory allocated by components by the library will automatically be deallocated, even when an exception is thrown. The library itself should never throw exceptions, except std::bad_alloc when memory couldn't be allocated: in the different parts of the documentation, algorithms whose space complexity is worse than O(1) can throw std::bad_alloc unless the documentation explicitly tells otherwise.

If the library throws any other exception, it will likely come from user code. The main functions that are likely to throw exceptions are the following ones:

  • User-defined comparison functions
  • User-defined projection functions
  • Move & swap operations of the objects to sort
  • Operations of the iterators/containers passed to the algorithms

Forward declarations

cpp-sort ships with a header that includes the forward declarations for the library's main components.

#include <cpp-sort/fwd.h>

Including that header will provide forward declarations for sorters, fixed-size sorters, and sorter adapters.

Miscellaneous

This wiki also includes a small section about the original research that happened during the conception of the library and the results of this research. While it is not needed to understand how the library works or how to use it, it may be of interest if you want to discover new things about sorting.

If you ever feel that this wiki is incomplete, that needs more examples or more detailed explanation about stuff, you are welcome to report it and/or contribute.

Always keep in mind that even if the library does contain production-ready algorithms, many of them are also experimental algorithms taken straight from research papers and reimplemented from scratch. If you are only interested in usable algorithms, you should look at the ones analyzed in the benchmarks.

Hope you have fun!