Skip to content

Commit bd10a77

Browse files
authored
Merge pull request #235 from Morwenn/2.x.y-develop
Release 2.1.0
2 parents 4774909 + 7101915 commit bd10a77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1418
-260
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright (c) 2026 Morwenn
2+
# SPDX-License-Identifier: MIT
3+
4+
name: Wiki Deployment
5+
6+
on:
7+
push:
8+
branches:
9+
- trunk
10+
paths:
11+
- 'docs/**'
12+
workflow_dispatch:
13+
14+
jobs:
15+
sync-wiki-files:
16+
name: Sync Wiki Files
17+
18+
runs-on: codeberg-tiny-lazy
19+
20+
steps:
21+
- name: Checkout /docs
22+
uses: actions/checkout@v6
23+
with:
24+
repository: ${{forgejo.repository}}
25+
path: main
26+
27+
- name: Checkout wiki
28+
uses: actions/checkout@v4
29+
with:
30+
repository: ${{forgejo.repository}}.wiki
31+
path: wiki
32+
33+
- name: Sync wiki files
34+
run: |
35+
apt-get update
36+
apt-get install -y rsync
37+
for docname in main/docs/*.md; do
38+
old=$(basename "$docname");
39+
new=${old%.*};
40+
find main/docs -name "*.md" -exec sed -i "s/$old/$new/g" {} \;
41+
done
42+
rsync -avzr --delete --exclude='.git/' "main/docs/" "wiki/"
43+
44+
- name: Commit changes
45+
working-directory: wiki
46+
run: |
47+
git config --local user.email "action@forgejo.org"
48+
git config --local user.name "Forgejo Action"
49+
git add .
50+
git commit -m "Synchronize wiki with docs/"
51+
52+
- name: Push changes to wiki
53+
working-directory: wiki
54+
run: |
55+
git push

.github/workflows/build-macos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ on:
2323

2424
jobs:
2525
build:
26-
runs-on: macos-13
26+
runs-on: macos-14
2727

2828
strategy:
2929
fail-fast: false
3030
matrix:
3131
config:
3232
# Release build
33-
- cxx: g++-12
33+
- cxx: g++-13
3434
build_type: Release
3535
- cxx: clang++
3636
build_type: Release

.github/workflows/deploy-to-wiki.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- 2.x.y-stable
1010
paths:
1111
- 'docs/**'
12+
workflow_dispatch:
1213

1314
jobs:
1415
sync-wiki-files:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2025 Morwenn
2+
# SPDX-License-Identifier: MIT
3+
4+
name: Mirror Commits to Codeberg
5+
6+
on: [push, workflow_dispatch]
7+
8+
jobs:
9+
mirror-to-codeberg:
10+
name: Mirror to Codeberg
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Mirror
21+
uses: yesolutions/mirror-action@v0.7.0
22+
with:
23+
REMOTE: 'https://codeberg.org/Morwenn/cpp-sort.git'
24+
GIT_USERNAME: Morwenn
25+
GIT_PASSWORD: ${{ secrets.GIT_PASSWORD }}

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# Copyright (c) 2015-2025 Morwenn
1+
# Copyright (c) 2015-2026 Morwenn
22
# SPDX-License-Identifier: MIT
33

44
cmake_minimum_required(VERSION 3.11.0)
55

66
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
77

8-
project(cpp-sort VERSION 2.0.0 LANGUAGES CXX)
8+
project(cpp-sort VERSION 2.1.0 LANGUAGES CXX)
99

1010
include(CMakePackageConfigHelpers)
11+
include(cpp-sort-utils)
1112
include(GNUInstallDirs)
1213

1314
# Project options
@@ -30,6 +31,7 @@ if (CPPSORT_USE_LIBASSERT)
3031
if (NOT libassert_POPULATED)
3132
FetchContent_Populate(libassert)
3233
add_subdirectory(${libassert_SOURCE_DIR} ${libassert_BINARY_DIR})
34+
mark_system_library(libassert-lib)
3335
endif()
3436
endif()
3537

README.md

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![cpp-sort logo](docs/images/cpp-sort-logo.svg)
22

3-
[![Latest Release](https://img.shields.io/badge/release-2.0.0-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/v2.0.0)
4-
[![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)
3+
[![Latest Release](https://img.shields.io/badge/release-2.1.0-blue.svg)](https://codeberg.org/Morwenn/cpp-sort/releases/tag/v2.1.0)
4+
[![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)
55
[![Code Coverage](https://codecov.io/gh/Morwenn/cpp-sort/branch/2.x.y-develop/graph/badge.svg)](https://codecov.io/gh/Morwenn/cpp-sort)
66
[![Pitchfork Layout](https://img.shields.io/badge/standard-PFL-orange.svg)](https://github.com/vector-of-bool/pitchfork)
77

@@ -41,11 +41,12 @@ anything to be backported._
4141

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

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

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

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

102103
# Benchmarks
103104

@@ -150,7 +151,7 @@ You can read more about those [in the wiki][tooling].
150151
> piece.*
151152
> — Jarod Kintz, $3.33
152153
153-
Even though some parts of the library are [original research](https://github.com/Morwenn/cpp-sort/wiki/Original-research)
154+
Even though some parts of the library are [original research][original-research]
154155
and some others correspond to custom and rather naive implementations of standard
155156
sorting algorithms, **cpp-sort** also reuses a great deal of code and ideas from
156157
open-source projects, often altered to integrate seamlessly into the library. Here
@@ -175,12 +176,11 @@ module](https://www.boost.org/doc/libs/1_80_0/libs/sort/doc/html/index.html).
175176
in [Boost.Sort](https://www.boost.org/doc/libs/1_80_0/libs/sort/doc/html/index.html).
176177
by Francisco Jose Tapia.
177178

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

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

232+
* The algorithm behind `utility::quicksort_adversary` is a fairly straightforward adaptation of the
233+
one provided by M. D. McIlroy in [*A Killer Adversary for Quicksort*](https://www.cs.dartmouth.edu/~doug/mdmspe.pdf).
234+
235+
* 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).
236+
232237
* The test suite reimplements random number algorithms originally found in the following places:
233238
- [xoshiro256\*\*](https://prng.di.unimi.it/)
234239
- [*Optimal Discrete Uniform Generation from Coin Flips, and Applications*](https://arxiv.org/abs/1304.1916)
@@ -245,9 +250,19 @@ developed by Thøger Rivera-Thorsen.
245250

246251

247252
[adaptive-sort]: https://en.wikipedia.org/wiki/Adaptive_sort
248-
[benchmarks]: https://github.com/Morwenn/cpp-sort/wiki/Benchmarks
249-
[changelog]: https://github.com/Morwenn/cpp-sort/wiki/Changelog
250-
[drop-merge-adapter]: https://github.com/Morwenn/cpp-sort/wiki/Sorter-adapters#drop_merge_adapter
251-
[heap-sorter]: https://github.com/Morwenn/cpp-sort/wiki/Sorters#heap_sorter
252-
[split-adapter]: https://github.com/Morwenn/cpp-sort/wiki/Sorter-adapters#split_adapter
253-
[tooling]: https://github.com/Morwenn/cpp-sort/wiki/Tooling
253+
[benchmarks]: https://codeberg.org/Morwenn/cpp-sort/wiki/Benchmarks
254+
[changelog]: https://codeberg.org/Morwenn/cpp-sort/wiki/Changelog
255+
[cpp-sort-wiki]: https://codeberg.org/Morwenn/cpp-sort/wiki
256+
[drop-merge-adapter]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorter-adapters#drop_merge_adapter
257+
[fixed-size-sorters]: https://codeberg.org/Morwenn/cpp-sort/wiki/Fixed-size-sorters
258+
[heap-sorter]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorters#heap_sorter
259+
[measures-of-disorder]: https://codeberg.org/Morwenn/cpp-sort/wiki/Measures-of-disorder
260+
[metrics]: https://codeberg.org/Morwenn/cpp-sort/wiki/Metrics
261+
[original-research]: https://codeberg.org/Morwenn/cpp-sort/wiki/Original-research
262+
[sorter-adapters]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorter-adapters
263+
[sorter-facade]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorter-facade
264+
[sorters]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorters
265+
[split-adapter]: https://codeberg.org/Morwenn/cpp-sort/wiki/Sorter-adapters#split_adapter
266+
[tooling]: https://codeberg.org/Morwenn/cpp-sort/wiki/Tooling
267+
[utility-as-function]: https://codeberg.org/Morwenn/cpp-sort/wiki/Miscellaneous-utilities#as_function
268+
[utility-check-strict-weak-ordering]: https://codeberg.org/Morwenn/cpp-sort/wiki/Miscellaneous-utilities#strict-weak-ordering-checker

benchmarks/errorbar-plot/plot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
def main():
1616
parser = argparse.ArgumentParser(description="Plot the results of the errorbar-plot benchmark.")
1717
parser.add_argument('root', help="directory with the result files to plot")
18-
parser.add_argument('--alternative-palette', dest='use_alt_palette',
19-
action='store_true', default=False,
18+
parser.add_argument('--alternative-palette',
19+
dest='use_alt_palette',
20+
action='store_true',
2021
help="Use another color palette")
2122
args = parser.parse_args()
2223

2324
root = pathlib.Path(args.root)
24-
result_files = list(root.glob('*.csv'))
25+
result_files = sorted(root.glob('*.csv'))
2526
if len(result_files) == 0:
2627
print(f"There are no files to plot in {root}")
2728
sys.exit(1)

cmake/cpp-sort-utils.cmake

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019-2023 Morwenn
1+
# Copyright (c) 2019-2025 Morwenn
22
# SPDX-License-Identifier: MIT
33

44
# Add a selection of warnings to a target
@@ -15,3 +15,17 @@ macro(cppsort_add_warnings target)
1515
)
1616
endif()
1717
endmacro()
18+
19+
# Mark a target as a SYSTEM library
20+
function(mark_system_library target)
21+
get_target_property(
22+
TARGET_INCLUDE_DIR
23+
${target}
24+
INTERFACE_INCLUDE_DIRECTORIES
25+
)
26+
set_target_properties(
27+
${target}
28+
PROPERTIES
29+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${TARGET_INCLUDE_DIR}"
30+
)
31+
endfunction()

conanfile.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Copyright (c) 2018-2025 Morwenn
3+
# Copyright (c) 2018-2026 Morwenn
44
# SPDX-License-Identifier: MIT
55

66
import os.path
@@ -16,10 +16,10 @@
1616

1717
class CppSortConan(ConanFile):
1818
name = "cpp-sort"
19-
version = "2.0.0"
19+
version = "2.1.0"
2020
description = "Sorting algorithms & related tools"
2121
license = "MIT"
22-
url = "https://github.com/Morwenn/cpp-sort"
22+
url = "https://codeberg.org/Morwenn/cpp-sort"
2323
homepage = url
2424
topics = "cpp-sort", "sorting", "algorithms"
2525
author = "Morwenn <morwenn29@hotmail.fr>"
@@ -29,7 +29,8 @@ class CppSortConan(ConanFile):
2929
exports_sources = [
3030
"include/*",
3131
"CMakeLists.txt",
32-
"cmake/cpp-sort-config.cmake.in"
32+
"cmake/cpp-sort-config.cmake.in",
33+
"cmake/cpp-sort-utils.cmake",
3334
]
3435
settings = "os", "compiler", "build_type", "arch"
3536
package_type = "header-library"

docs/.redirects.gollum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
Measures-of-presortedness.md: Measures-of-disorder.md

0 commit comments

Comments
 (0)