Skip to content

Commit

Permalink
Merge pull request #205 from Morwenn/develop
Browse files Browse the repository at this point in the history
Release 1.13.0
  • Loading branch information
Morwenn committed Apr 12, 2022
2 parents 4b783a0 + bcaa6b6 commit 72b3855
Show file tree
Hide file tree
Showing 201 changed files with 4,393 additions and 2,559 deletions.
8 changes: 4 additions & 4 deletions .github/.codecov.yml
@@ -1,14 +1,14 @@
# Copyright (c) 2018-2020 Morwenn
# Copyright (c) 2018-2022 Morwenn
# SPDX-License-Identifier: MIT

coverage:
ignore:
- "testsuite"
- "tests"
# This unrolled version of a merge-insertion sort derivative was tested
# exhaustively for every permutation of an integer sequence of 9 elements,
# thus we don't include it
- "include/cpp-sort/detail/low_comparisons/sort9.h"
# Sorting networks have been tested independently with the 0-1 principle
# when needed, and are otherwise simple enough that we do not need the
# testsuite to test all of them
# when needed, so we do not need to test them exhaustively in the test
# suite
- "include/cpp-sort/detail/sorting_network/*"
6 changes: 3 additions & 3 deletions .github/workflows/build-macos.yml
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Morwenn
# Copyright (c) 2021-2022 Morwenn
# SPDX-License-Identifier: MIT

name: MacOS Builds
Expand All @@ -11,15 +11,15 @@ on:
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'testsuite/**'
- 'tests/**'
pull_request:
paths:
- '.github/workflows/build-macos.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'testsuite/**'
- 'tests/**'

jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-mingw.yml
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Morwenn
# Copyright (c) 2021-2022 Morwenn
# SPDX-License-Identifier: MIT

name: MinGW-w64 Builds
Expand All @@ -11,15 +11,15 @@ on:
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'testsuite/**'
- 'tests/**'
pull_request:
paths:
- '.github/workflows/build-mingw.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'testsuite/**'
- 'tests/**'

jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-msvc.yml
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Morwenn
# Copyright (c) 2021-2022 Morwenn
# SPDX-License-Identifier: MIT

name: MSVC Builds
Expand All @@ -11,15 +11,15 @@ on:
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'testsuite/**'
- 'tests/**'
pull_request:
paths:
- '.github/workflows/build-msvc.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'testsuite/**'
- 'tests/**'

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-ubuntu.yml
Expand Up @@ -11,15 +11,15 @@ on:
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'testsuite/**'
- 'tests/**'
pull_request:
paths:
- '.github/workflows/build-ubuntu.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'testsuite/**'
- 'tests/**'

jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/code-coverage.yml
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Morwenn
# Copyright (c) 2020-2022 Morwenn
# SPDX-License-Identifier: MIT

name: Coverage Upload to Codecov
Expand All @@ -15,7 +15,7 @@ on:
- 'CMakeLists.txt'
- 'cmake/**'
- 'include/**'
- 'testsuite/**'
- 'tests/**'

jobs:
upload-coverage:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
run: cmake --build . --target lcov-capture

- name: Upload coverage info
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
directory: ${{runner.workspace}}/build/lcov/data
files: '*.info'
Expand Down
44 changes: 37 additions & 7 deletions .github/workflows/deploy-to-wiki.yml
@@ -1,11 +1,14 @@
# Copyright (c) 2020-2022 Morwenn
# SPDX-License-Identifier: MIT

name: Wiki Deployment

on:
push:
branches:
- master
paths:
- 'docs/**'
- 'docs/**'

jobs:
sync-wiki-files:
Expand All @@ -15,10 +18,37 @@ jobs:

steps:
- name: Checkout /docs
uses: actions/checkout@master
- name: Sync .wiki with /docs
uses: SwiftDocOrg/github-wiki-publish-action@rsync
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: main

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

- name: Sync wiki files
run: |
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 "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Synchronize wiki with docs/"
- name: Push changes to wiki
uses: ad-m/github-push-action@master
with:
path: docs/
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.DEPLOY_TO_WIKI_ACCESS_TOKEN }}
directory: wiki
repository: ${{github.repository}}.wiki
branch: master
4 changes: 2 additions & 2 deletions CMakeLists.txt
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.8.0)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

project(cpp-sort VERSION 1.12.1 LANGUAGES CXX)
project(cpp-sort VERSION 1.13.0 LANGUAGES CXX)

include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
Expand Down Expand Up @@ -86,7 +86,7 @@ export(
if (PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
if (CPPSORT_BUILD_TESTING)
enable_testing()
add_subdirectory(testsuite)
add_subdirectory(tests)
endif()

if (CPPSORT_BUILD_EXAMPLES)
Expand Down
30 changes: 30 additions & 0 deletions NOTICE.txt
Expand Up @@ -26,7 +26,37 @@ THE SOFTWARE.

In addition, certain files include the notices provided below.

/*
* C++ implementation of timsort
*
* ported from Python's and OpenJDK's:
* - http://svn.python.org/projects/python/trunk/Objects/listobject.c
* - http://cr.openjdk.java.net/~martin/webrevs/openjdk7/timsort/raw_files/new/src/share/classes/java/util/TimSort.java
*
* Copyright (c) 2011 Fuji, Goro (gfx) <gfuji@cpan.org>.
* Copyright (c) 2015-2022 Morwenn.
* Copyright (c) 2021 Igor Kushnir <igorkuo@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

----------------------

/*
* WikiSort: a public domain implementation of "Block Sort"
Expand Down
21 changes: 8 additions & 13 deletions README.md
@@ -1,6 +1,9 @@
[![Latest Release](https://img.shields.io/badge/release-1.12.1-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/1.12.1)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.12.1-blue.svg)](https://conan.io/center/cpp-sort?version=1.12.1)
![cpp-sort logo](docs/images/cpp-sort-logo.svg)

[![Latest Release](https://img.shields.io/badge/release-1.13.0-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/1.13.0)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.13.0-blue.svg)](https://conan.io/center/cpp-sort?version=1.13.0)
[![Code Coverage](https://codecov.io/gh/Morwenn/cpp-sort/branch/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)

> *It would be nice if only one or two of the sorting methods would dominate all of the others,
> regardless of application or the computer being used. But in fact, each method has its own
Expand Down Expand Up @@ -201,17 +204,9 @@ slightly modified version of Matthew Bentley's [indiesort](https://github.com/ma
comes from Danila Kutenin's [miniselect library](https://github.com/danlark1/miniselect) and uses
Andrei Alexandrescu's [*AdaptiveQuickselect*](https://arxiv.org/abs/1606.00484) algorithm.

* The algorithms 0 to 16 used by `sorting_network_sorter` have been generated with
Perl's [`Algorithm::Networksort` module](https://metacpan.org/pod/release/JGAMBLE/Algorithm-Networksort-1.30/lib/Algorithm/Networksort.pm).

* The algorithm 17 used by `sorting_network_sorter` correspond to the ones found by
Symmetry and Evolution based Network Sort Optimization (SENSO) published in *Using
Symmetry and Evolutionary Search to Minimize Sorting Networks* by Valsalam and Miikkulainen.

* The algorithms 18 to 26 and 28 used by `sorting_network_sorter` have been found and
proposed for inclusion by Bert Dobbelaere with his [SorterHunter project](https://github.com/bertdobbelaere/SorterHunter).
Huge thanks for this contribution :) You can find a full list of most well-known sorting
networks up to 32 inputs on his website.
* The sorting networks used by `sorting_network_sorter` all come [from this list](http://users.telenet.be/bertdobbelaere/SorterHunter/sorting_networks.html)
maintained by Bert Dobbelaere. The page has references to the sources of all of the sorting networks
it lists.

* Some of the optimizations used by `sorting_network_sorter` come from [this
discussion](https://stackoverflow.com/q/2786899/1364752) on StackOverflow and are
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Expand Up @@ -10,7 +10,7 @@

class CppSortConan(ConanFile):
name = "cpp-sort"
version = "1.12.1"
version = "1.13.0"
description = "Additional sorting algorithms & related tools"
topics = "conan", "cpp-sort", "sorting", "algorithms"
url = "https://github.com/Morwenn/cpp-sort"
Expand Down
2 changes: 1 addition & 1 deletion docs/Benchmarks.md
Expand Up @@ -177,6 +177,6 @@ It makes rather easy to see the different groups of complexities:
* All of the other measures of presortedness run in O(n log n) time.


[measures-of-presortedness]: https://github.com/Morwenn/cpp-sort/wiki/Measures-of-presortedness
[measures-of-presortedness]: Measures-of-presortedness.md
[std-forward-list-sort]: https://en.cppreference.com/w/cpp/container/list/sort
[std-list-sort]: https://en.cppreference.com/w/cpp/container/list/sort
13 changes: 9 additions & 4 deletions docs/Chainable-projections.md
Expand Up @@ -13,7 +13,7 @@ struct my_negate:
};
```

Making a function object inherit from `cppsort::utility::projection_base` allows it to benefit from the `operator|` overload used to compose projections; the projection inheriting from that class can appear on any side of the operator, and the other argument can be any suitable [*Callable*][callable]. Here is an example of what is possible with the custom projection defined above:
Making a function object inherit from `utility::projection_base` allows it to benefit from the `operator|` overload used to compose projections; the projection inheriting from that class can appear on any side of the operator, and the other argument can be any suitable [*Callable*][callable]. Here is an example of what is possible with the custom projection defined above:

```cpp
// Create a vector of wrapper
Expand All @@ -25,8 +25,13 @@ my_negate projection;
cppsort::poplar_sort(vec, &wrapper::value | projection);
```
The object returned by the utility function [`cppsort::utility::as_projection`][as_projection] also inherits from `cppsort::utility::projection_base`, making `as_projection` the proper function to turn any suitable projection into a projection composable with `operator|`.
The object returned by the utility function [`utility::as_projection`][as_projection] also inherits from `utility::projection_base`, making `as_projection` the proper function to turn any suitable projection into a projection composable with `operator|`.
If both of the projections composed with `operator|` are [*transparent*][transparent-func], then the returned object is also a *transparent* projection.
[as_projection]: https://github.com/Morwenn/cpp-sort/wiki/Miscellaneous-utilities#as_comparison-and-as_projection
[callable]: https://en.cppreference.com/w/cpp/named_req/Callable
*Changed in version 1.13.0:* the object returned by `operator|` is now conditionally [*transparent*][transparent-func].
[as_projection]: Miscellaneous-utilities.md#as_comparison-and-as_projection
[callable]: https://en.cppreference.com/w/cpp/named_req/Callable
[transparent-func]: Comparators-and-projections.md#Transparent-function-objects
16 changes: 9 additions & 7 deletions docs/Changelog.md
Expand Up @@ -92,19 +92,21 @@ When compiled with C++20, **cpp-sort** might gain a few additional features depe
* When using libstdc++, libc++ or the Microsoft STL, the return type of [`std::mem_fn`][std-mem-fn] is considered ["probably branchless"][branchless-traits] when it wraps a pointer to data member, which can improve the speed of [`pdq_sorter`][pdq-sorter] and everything that relies on it in some scenarios.


[branchless-traits]: https://github.com/Morwenn/cpp-sort/wiki/Miscellaneous-utilities#branchless-traits
[counting-sorter]: https://github.com/Morwenn/cpp-sort/wiki/Sorters#counting_sorter
[cpp-sort-function-objects]: https://github.com/Morwenn/cpp-sort/wiki/Miscellaneous-utilities#miscellaneous-function-objects
[branchless-traits]: Miscellaneous-utilities.md#branchless-traits
[counting-sorter]: Sorters.md#counting_sorter
[cpp-sort-function-objects]: Miscellaneous-utilities.md#miscellaneous-function-objects
[cpp-sort-releases]: https://github.com/Morwenn/cpp-sort/releases
[feature-test-macros]: https://wg21.link/SD6
[pdq-sorter]: https://github.com/Morwenn/cpp-sort/wiki/Sorters#pdq_sorter
[ska-sorter]: https://github.com/Morwenn/cpp-sort/wiki/Sorters#ska_sorter
[sorter-facade]: https://github.com/Morwenn/cpp-sort/wiki/Sorter-facade
[pdq-sorter]: Sorters.md#pdq_sorter
[ska-sorter]: Sorters.md#ska_sorter
[smooth-sorter]: Sorters.md#smooth-sorter_sorter
[sorter-facade]: Sorter-facade.md
[std-greater-void]: https://en.cppreference.com/w/cpp/utility/functional/greater_void
[std-identity]: https://en.cppreference.com/w/cpp/utility/functional/identity
[std-less-void]: https://en.cppreference.com/w/cpp/utility/functional/less_void
[std-mem-fn]: https://en.cppreference.com/w/cpp/utility/functional/mem_fn
[std-ranges-greater]: https://en.cppreference.com/w/cpp/utility/functional/ranges/greater
[std-ranges-less]: https://en.cppreference.com/w/cpp/utility/functional/ranges/less
[std-string-view]: https://en.cppreference.com/w/cpp/string/basic_string_view
[utility-iter-move]: https://github.com/Morwenn/cpp-sort/wiki/Miscellaneous-utilities#iter_move-and-iter_swap
[std-swap]: https://en.cppreference.com/w/cpp/algorithm/swap
[utility-iter-move]: Miscellaneous-utilities.md#iter_move-and-iter_swap

0 comments on commit 72b3855

Please sign in to comment.