Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6bb1b5a
Allow to run the action to deploy the wiki manually
Morwenn Sep 21, 2025
6cf368a
Fix overflow issue with signed subtraction in float_sort
Morwenn Sep 29, 2025
25e3bdc
Wrap std::min/std::max in parentheses
Morwenn Sep 29, 2025
ebd2b07
Upgrade downloaded Catch2 version to v3.11.0
Morwenn Sep 30, 2025
701a916
Mark internal container functions with lifetimebound attribute
Morwenn Oct 2, 2025
4f8c43c
Don't needlessly use decltype in buffers
Morwenn Oct 3, 2025
23a625a
Add lifetime annotations to cppsort::utility::metrics
Morwenn Oct 3, 2025
7e6b9c2
Add lifetime annotations to adapter_storage
Morwenn Oct 3, 2025
c64a070
Add lifetime annotations to buffer types
Morwenn Oct 3, 2025
eb88584
Add bug fixes category to the release template
Morwenn Oct 4, 2025
393ac87
Add more lifetime annotations
Morwenn Oct 4, 2025
3883324
Add a quicksort_adversary utility (#178)
Morwenn Oct 9, 2025
363ba03
Base LDS and LNDS on longest increasing subsequence
Morwenn Oct 15, 2025
856163e
Improve rendering of documentation with Gollum
Morwenn Oct 15, 2025
c85c634
Fix rendering of benchmarks with Gollum
Morwenn Oct 16, 2025
3a571b3
Add a Gollum redirects file to the documentation
Morwenn Oct 16, 2025
7e34bc2
Add action to mirror commits to codeberg
Morwenn Oct 19, 2025
2e8c3ad
CI: uprade MacOS image to macos-14
Morwenn Oct 31, 2025
7ed94c6
New measure of disorder: Amp
Morwenn Nov 15, 2025
4aadf9a
CI: upgrade MacOS GCC version to 13
Morwenn Nov 15, 2025
4244d1e
Doc: improve kerning of math expressions
Morwenn Nov 28, 2025
5f66f2b
Don't pass --rng-seed in catch_discover_tests
Morwenn Dec 18, 2025
b1383a3
Mark libassert as a SYSTEM library
Morwenn Dec 21, 2025
c60447e
Upgrade downloaded Catch2 version to v3.12.0
Morwenn Dec 29, 2025
496eadc
Add Forgejo action to deploy docs to Codeberg Wiki
Morwenn Jan 3, 2026
1faa5ce
Embrase the dual GitHub/Codeberg nature of the project
Morwenn Jan 3, 2026
315fe62
Documentation: fix a few links
Morwenn Jan 3, 2026
48225af
Add utility::check_strict_weak_ordering
Morwenn Jan 11, 2026
2b69ba2
Add utility::is_sorted[_until]
Morwenn Jan 12, 2026
844bf24
Add a visual explanation of the measure of disorder Osc
Morwenn Jan 13, 2026
bffea67
Add a visual explanation of the measure of disorder Exc
Morwenn Jan 13, 2026
22b86c6
Document the measure disorder SMS
Morwenn Jan 13, 2026
6342d0e
Document measures of disorder Las, Lds and Lads
Morwenn Jan 13, 2026
f2fc7ff
Complete flip documentation with a link to my blog
Morwenn Jan 14, 2026
072d76e
Add a section about metrics in the Quickstart
Morwenn Jan 15, 2026
6a94636
Metnion metrics in README
Morwenn Jan 15, 2026
13512ae
errorbar-plot: order the legend alphabetically
Morwenn Jan 16, 2026
40a6e27
Update benchmark: measures of disorder
Morwenn Jan 16, 2026
8a67fc4
Preparing release 2.1.0
Morwenn Jan 16, 2026
7101915
conanfile.py: add missing cpp-sort-utils.cmake to export_sources
Morwenn Jan 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .forgejo/workflows/deploy-to-wiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright (c) 2026 Morwenn
# SPDX-License-Identifier: MIT

name: Wiki Deployment

on:
push:
branches:
- trunk
paths:
- 'docs/**'
workflow_dispatch:

jobs:
sync-wiki-files:
name: Sync Wiki Files

runs-on: codeberg-tiny-lazy

steps:
- name: Checkout /docs
uses: actions/checkout@v6
with:
repository: ${{forgejo.repository}}
path: main

- name: Checkout wiki
uses: actions/checkout@v4
with:
repository: ${{forgejo.repository}}.wiki
path: wiki

- name: Sync wiki files
run: |
apt-get update
apt-get install -y rsync
for docname in main/docs/*.md; do
old=$(basename "$docname");
new=${old%.*};
find main/docs -name "*.md" -exec sed -i "s/$old/$new/g" {} \;
done
rsync -avzr --delete --exclude='.git/' "main/docs/" "wiki/"

- name: Commit changes
working-directory: wiki
run: |
git config --local user.email "[email protected]"
git config --local user.name "Forgejo Action"
git add .
git commit -m "Synchronize wiki with docs/"

- name: Push changes to wiki
working-directory: wiki
run: |
git push
4 changes: 2 additions & 2 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ on:

jobs:
build:
runs-on: macos-13
runs-on: macos-14

strategy:
fail-fast: false
matrix:
config:
# Release build
- cxx: g++-12
- cxx: g++-13
build_type: Release
- cxx: clang++
build_type: Release
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-to-wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 2.x.y-stable
paths:
- 'docs/**'
workflow_dispatch:

jobs:
sync-wiki-files:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/mirror-to-codeberg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2025 Morwenn
# SPDX-License-Identifier: MIT

name: Mirror Commits to Codeberg

on: [push, workflow_dispatch]

jobs:
mirror-to-codeberg:
name: Mirror to Codeberg

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Mirror
uses: yesolutions/[email protected]
with:
REMOTE: 'https://codeberg.org/Morwenn/cpp-sort.git'
GIT_USERNAME: Morwenn
GIT_PASSWORD: ${{ secrets.GIT_PASSWORD }}
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Copyright (c) 2015-2025 Morwenn
# Copyright (c) 2015-2026 Morwenn
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.11.0)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

project(cpp-sort VERSION 2.0.0 LANGUAGES CXX)
project(cpp-sort VERSION 2.1.0 LANGUAGES CXX)

include(CMakePackageConfigHelpers)
include(cpp-sort-utils)
include(GNUInstallDirs)

# Project options
Expand All @@ -30,6 +31,7 @@ if (CPPSORT_USE_LIBASSERT)
if (NOT libassert_POPULATED)
FetchContent_Populate(libassert)
add_subdirectory(${libassert_SOURCE_DIR} ${libassert_BINARY_DIR})
mark_system_library(libassert-lib)
endif()
endif()

Expand Down
57 changes: 36 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![cpp-sort logo](docs/images/cpp-sort-logo.svg)

[![Latest Release](https://img.shields.io/badge/release-2.0.0-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/v2.0.0)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F2.0.0-blue.svg)](https://conan.io/center/recipes/cpp-sort?version=2.0.0)
[![Latest Release](https://img.shields.io/badge/release-2.1.0-blue.svg)](https://codeberg.org/Morwenn/cpp-sort/releases/tag/v2.1.0)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F2.1.0-blue.svg)](https://conan.io/center/recipes/cpp-sort?version=2.1.0)
[![Code Coverage](https://codecov.io/gh/Morwenn/cpp-sort/branch/2.x.y-develop/graph/badge.svg)](https://codecov.io/gh/Morwenn/cpp-sort)
[![Pitchfork Layout](https://img.shields.io/badge/standard-PFL-orange.svg)](https://github.com/vector-of-bool/pitchfork)

Expand Down Expand Up @@ -41,11 +41,12 @@ anything to be backported._

**cpp-sort** provides a full set of sorting-related features. Here are the main building blocks
of the library:
* Every sorting algorithm exists as a function object called a [sorter](https://github.com/Morwenn/cpp-sort/wiki/Sorters)
* Sorters can be wrapped in [sorter adapters](https://github.com/Morwenn/cpp-sort/wiki/Sorter-adapters) to augment their behaviour
* The library provides a [sorter facade](https://github.com/Morwenn/cpp-sort/wiki/Sorter-facade) to easily build sorters
* [Fixed-size sorters](https://github.com/Morwenn/cpp-sort/wiki/Fixed-size-sorters) can be used to efficiently sort tiny fixed-size collections
* [Measures of disorder](https://github.com/Morwenn/cpp-sort/wiki/Measures-of-disorder) can be used to evaluate the disorder in a collection
* Every sorting algorithm exists as a function object called a [sorter][sorters]
* Sorters can be wrapped in [sorter adapters][sorter-adapters] to augment their behaviour
* The library provides a [sorter facade][sorter-facade] to easily build sorters
* [Fixed-size sorters][fixed-size-sorters] can be used to efficiently sort tiny fixed-size collections
* [Metrics][metrics] can be used to gather information about the sorting operation
* [Measures of disorder][measures-of-disorder] can be used to evaluate the disorder in a collection

Here is a more complete example of what can be done with the library:

Expand Down Expand Up @@ -97,7 +98,7 @@ some interesting guarantees (ideas often taken from the Ranges TS):
* Sorters are function objects: they can directly be passed as "overload sets" to other functions

You can read more about all the available tools and find some tutorials about using
and extending **cpp-sort** in [the wiki](https://github.com/Morwenn/cpp-sort/wiki).
and extending **cpp-sort** in [the wiki][cpp-sort-wiki].

# Benchmarks

Expand Down Expand Up @@ -150,7 +151,7 @@ You can read more about those [in the wiki][tooling].
> piece.*
> — Jarod Kintz, $3.33

Even though some parts of the library are [original research](https://github.com/Morwenn/cpp-sort/wiki/Original-research)
Even though some parts of the library are [original research][original-research]
and some others correspond to custom and rather naive implementations of standard
sorting algorithms, **cpp-sort** also reuses a great deal of code and ideas from
open-source projects, often altered to integrate seamlessly into the library. Here
Expand All @@ -175,12 +176,11 @@ module](https://www.boost.org/doc/libs/1_80_0/libs/sort/doc/html/index.html).
in [Boost.Sort](https://www.boost.org/doc/libs/1_80_0/libs/sort/doc/html/index.html).
by Francisco Jose Tapia.

* [`utility::as_function`](https://github.com/Morwenn/cpp-sort/wiki/Miscellaneous-utilities#as_function),
and several projection-enhanced helper algorithms come from Eric Niebler's [Range
v3](https://github.com/ericniebler/range-v3) library. Several ideas such as proxy
iterators, customization points and projections, as well as a few other utility
functions also come from that library or from the related articles and standard
C++ proposals.
* [`utility::as_function`][utility-as-function], and several projection-enhanced helper
algorithms come from Eric Niebler's [Range v3](https://github.com/ericniebler/range-v3)
library. Several ideas such as proxy iterators, customization points and projections,
as well as a few other utility functions also come from that library or from the related
articles and standard C++ proposals.

* The algorithm used by `ska_sorter` comes from Malte Skarupke's [implementation](https://github.com/skarupke/ska_sort)
of his own [ska_sort](https://probablydance.com/2016/12/27/i-wrote-a-faster-sorting-algorithm/) algorithm.
Expand Down Expand Up @@ -229,6 +229,11 @@ discussion](https://stackoverflow.com/q/2786899/1364752) on StackOverflow and ar
backed by the article [*Applying Sorting Networks to Synthesize Optimized Sorting
Libraries*](https://arxiv.org/abs/1505.01962).

* The algorithm behind `utility::quicksort_adversary` is a fairly straightforward adaptation of the
one provided by M. D. McIlroy in [*A Killer Adversary for Quicksort*](https://www.cs.dartmouth.edu/~doug/mdmspe.pdf).

* The algorithm used by [`utility::check_strict_weak_ordering`][utility-check-strict-weak-ordering] is a reimplementation of the one desribed in the README file of Danila Kutenin's [quadratic_strict_weak_ordering project](https://github.com/danlark1/quadratic_strict_weak_ordering).

* The test suite reimplements random number algorithms originally found in the following places:
- [xoshiro256\*\*](https://prng.di.unimi.it/)
- [*Optimal Discrete Uniform Generation from Coin Flips, and Applications*](https://arxiv.org/abs/1304.1916)
Expand All @@ -245,9 +250,19 @@ developed by Thøger Rivera-Thorsen.


[adaptive-sort]: https://en.wikipedia.org/wiki/Adaptive_sort
[benchmarks]: https://github.com/Morwenn/cpp-sort/wiki/Benchmarks
[changelog]: https://github.com/Morwenn/cpp-sort/wiki/Changelog
[drop-merge-adapter]: https://github.com/Morwenn/cpp-sort/wiki/Sorter-adapters#drop_merge_adapter
[heap-sorter]: https://github.com/Morwenn/cpp-sort/wiki/Sorters#heap_sorter
[split-adapter]: https://github.com/Morwenn/cpp-sort/wiki/Sorter-adapters#split_adapter
[tooling]: https://github.com/Morwenn/cpp-sort/wiki/Tooling
[benchmarks]: https://codeberg.org/Morwenn/cpp-sort/wiki/Benchmarks
[changelog]: https://codeberg.org/Morwenn/cpp-sort/wiki/Changelog
[cpp-sort-wiki]: https://codeberg.org/Morwenn/cpp-sort/wiki
[drop-merge-adapter]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorter-adapters#drop_merge_adapter
[fixed-size-sorters]: https://codeberg.org/Morwenn/cpp-sort/wiki/Fixed-size-sorters
[heap-sorter]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorters#heap_sorter
[measures-of-disorder]: https://codeberg.org/Morwenn/cpp-sort/wiki/Measures-of-disorder
[metrics]: https://codeberg.org/Morwenn/cpp-sort/wiki/Metrics
[original-research]: https://codeberg.org/Morwenn/cpp-sort/wiki/Original-research
[sorter-adapters]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorter-adapters
[sorter-facade]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorter-facade
[sorters]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorters
[split-adapter]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorter-adapters#split_adapter
[tooling]: https://codeberg.org/Morwenn/cpp-sort/wiki/Tooling
[utility-as-function]: https://codeberg.org/Morwenn/cpp-sort/wiki/Miscellaneous-utilities#as_function
[utility-check-strict-weak-ordering]: https://codeberg.org/Morwenn/cpp-sort/wiki/Miscellaneous-utilities#strict-weak-ordering-checker
7 changes: 4 additions & 3 deletions benchmarks/errorbar-plot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
def main():
parser = argparse.ArgumentParser(description="Plot the results of the errorbar-plot benchmark.")
parser.add_argument('root', help="directory with the result files to plot")
parser.add_argument('--alternative-palette', dest='use_alt_palette',
action='store_true', default=False,
parser.add_argument('--alternative-palette',
dest='use_alt_palette',
action='store_true',
help="Use another color palette")
args = parser.parse_args()

root = pathlib.Path(args.root)
result_files = list(root.glob('*.csv'))
result_files = sorted(root.glob('*.csv'))
if len(result_files) == 0:
print(f"There are no files to plot in {root}")
sys.exit(1)
Expand Down
16 changes: 15 additions & 1 deletion cmake/cpp-sort-utils.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2023 Morwenn
# Copyright (c) 2019-2025 Morwenn
# SPDX-License-Identifier: MIT

# Add a selection of warnings to a target
Expand All @@ -15,3 +15,17 @@ macro(cppsort_add_warnings target)
)
endif()
endmacro()

# Mark a target as a SYSTEM library
function(mark_system_library target)
get_target_property(
TARGET_INCLUDE_DIR
${target}
INTERFACE_INCLUDE_DIRECTORIES
)
set_target_properties(
${target}
PROPERTIES
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${TARGET_INCLUDE_DIR}"
)
endfunction()
9 changes: 5 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2018-2025 Morwenn
# Copyright (c) 2018-2026 Morwenn
# SPDX-License-Identifier: MIT

import os.path
Expand All @@ -16,10 +16,10 @@

class CppSortConan(ConanFile):
name = "cpp-sort"
version = "2.0.0"
version = "2.1.0"
description = "Sorting algorithms & related tools"
license = "MIT"
url = "https://github.com/Morwenn/cpp-sort"
url = "https://codeberg.org/Morwenn/cpp-sort"
homepage = url
topics = "cpp-sort", "sorting", "algorithms"
author = "Morwenn <[email protected]>"
Expand All @@ -29,7 +29,8 @@ class CppSortConan(ConanFile):
exports_sources = [
"include/*",
"CMakeLists.txt",
"cmake/cpp-sort-config.cmake.in"
"cmake/cpp-sort-config.cmake.in",
"cmake/cpp-sort-utils.cmake",
]
settings = "os", "compiler", "build_type", "arch"
package_type = "header-library"
Expand Down
2 changes: 2 additions & 0 deletions docs/.redirects.gollum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
Measures-of-presortedness.md: Measures-of-disorder.md
Loading