Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2025 Morwenn
# Copyright (c) 2021-2026 Morwenn
# SPDX-License-Identifier: MIT

name: MacOS Builds
Expand All @@ -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
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.8.0)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

project(cpp-sort VERSION 1.17.1 LANGUAGES CXX)
project(cpp-sort VERSION 1.17.2 LANGUAGES CXX)

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

# Project options
Expand All @@ -28,6 +29,7 @@ if (CPPSORT_USE_LIBASSERT)
UPDATE_DISCONNECTED 1
)
add_subdirectory(${libassert_SOURCE_DIR} ${libassert_BINARY_DIR})
mark_system_library(libassert-lib)
endif()

# Create cpp-sort library and configure it
Expand Down
4 changes: 2 additions & 2 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-1.17.1-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/1.17.1)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.17.1-blue.svg)](https://conan.io/center/recipes/cpp-sort?version=1.17.1)
[![Latest Release](https://img.shields.io/badge/release-1.17.2-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/1.17.2)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.17.2-blue.svg)](https://conan.io/center/recipes/cpp-sort?version=1.17.2)
[![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)

Expand Down
7 changes: 4 additions & 3 deletions benchmarks/errorbar-plot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,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()
7 changes: 4 additions & 3 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,7 +16,7 @@

class CppSortConan(ConanFile):
name = "cpp-sort"
version = "1.17.1"
version = "1.17.2"
description = "Sorting algorithms & related tools"
license = "MIT"
url = "https://github.com/Morwenn/cpp-sort"
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
4 changes: 2 additions & 2 deletions docs/Comparators.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ The two-parameter version of the customization point calls the three-parameter o
*Changed in version 1.5.0:* `case_insensitive_less` is an instance of type `case_insensitive_less_t`.


[binary-predicate]: https://en.cppreference.com/w/cpp/concept/BinaryPredicate
[binary-predicate]: https://en.cppreference.com/w/cpp/named_req/BinaryPredicate
[branchless-traits]: Miscellaneous-utilities.md#branchless-traits
[callable]: https://en.cppreference.com/w/cpp/named_req/Callable
[case-sensitivity]: https://en.wikipedia.org/wiki/Case_sensitivity
[cppcon2015-compare]: https://github.com/CppCon/CppCon2015/tree/master/Presentations/Comparison%20is%20not%20simple%2C%20but%20it%20can%20be%20simpler%20-%20Lawrence%20Crowl%20-%20CppCon%202015
[cppcon2015-compare]: https://github.com/CppCon/CppCon2015/tree/master/Presentations/Comparison%20is%20not%20simple%2C%20but%20it%20can%20be%20simpler
[custom-point]: https://ericniebler.com/2014/10/21/customization-point-design-in-c11-and-beyond/
[natural-sort]: https://en.wikipedia.org/wiki/Natural_sort_order
[P0100]: http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0100r1.html
Expand Down
2 changes: 1 addition & 1 deletion docs/Home.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![cpp-sort logo](images/cpp-sort-logo.svg)

Welcome to the **cpp-sort 1.17.1** documentation!
Welcome to the **cpp-sort 1.17.2** documentation!

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, as well as a few tutorials about writing your own sorters or sorter adapters. This main page explains a few general things that didn't quite fit in other parts of the documentation.

Expand Down
2 changes: 1 addition & 1 deletion docs/Original-research.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ The following relations have yet to be analyzed:

[better-sorting-networks]: https://etd.ohiolink.edu/!etd.send_file?accession=kent1239814529
[cycle-sort]: https://en.wikipedia.org/wiki/Cycle_sort
[divide-sort-merge-strategy]: http://www.dtic.mil/dtic/tr/fulltext/u2/737270.pdf
[divide-sort-merge-strategy]: https://apps.dtic.mil/sti/tr/pdf/AD0737270.pdf
[exact-sort]: https://www.geocities.ws/p356spt/
[indirect-adapter]: Sorter-adapters.md#indirect_adapter
[morwenn-gist]: https://gist.github.com/Morwenn
Expand Down
4 changes: 2 additions & 2 deletions docs/Tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ Note: when `CPPSORT_ENABLE_AUDITS` is `ON`, assertions in the library are enable
conan search cpp-sort --remote=conancenter
```

And then install any version to your local cache as follows (here with version 1.17.1):
And then install any version to your local cache as follows (here with version 1.17.2):

```sh
conan install --requires=cpp-sort/1.17.1
conan install --requires=cpp-sort/1.17.2
```

The packages downloaded from conan-center are minimal and only contain the files required to use **cpp-sort** as a library: the headers, CMake files and licensing information. If you need anything else you have to create your own package with the `conanfile.py` available in this repository.
Expand Down
4 changes: 2 additions & 2 deletions include/cpp-sort/detail/grail_sort.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2022 Morwenn
* Copyright (c) 2015-2026 Morwenn
* SPDX-License-Identifier: MIT
*/

Expand Down Expand Up @@ -471,7 +471,7 @@ namespace grail
auto&& proj = utility::as_function(projection);
auto size = last - first;

auto kbuf = std::min(K, LExtBuf);
auto kbuf = (std::min)(K, LExtBuf);
while (kbuf & (kbuf - 1)) {
kbuf &= kbuf - 1; // max power or 2 - just in case
}
Expand Down
8 changes: 4 additions & 4 deletions include/cpp-sort/detail/spreadsort/detail/float_sort.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2021 Morwenn
* Copyright (c) 2015-2026 Morwenn
* SPDX-License-Identifier: MIT
*/

Expand Down Expand Up @@ -143,7 +143,7 @@ namespace detail
auto&& proj = utility::as_function(projection);

unsigned log_divisor = get_log_divisor<float_log_mean_bin_size>(
last - first, rough_log_2_size(Size_type(max - min)));
last - first, rough_log_2_size(Size_type(max/2 - min/2)) + 1);
Div_type div_min = min >> log_divisor;
Div_type div_max = max >> log_divisor;
unsigned bin_count = unsigned(div_max - div_min) + 1;
Expand Down Expand Up @@ -209,7 +209,7 @@ namespace detail
auto&& proj = utility::as_function(projection);

unsigned log_divisor = get_log_divisor<float_log_mean_bin_size>(
last - first, rough_log_2_size(Size_type(max - min)));
last - first, rough_log_2_size(Size_type(max/2 - min/2)) + 1);
Div_type div_min = min >> log_divisor;
Div_type div_max = max >> log_divisor;
unsigned bin_count = unsigned(div_max - div_min) + 1;
Expand Down Expand Up @@ -274,7 +274,7 @@ namespace detail
auto&& proj = utility::as_function(projection);

unsigned log_divisor = get_log_divisor<float_log_mean_bin_size>(
last - first, rough_log_2_size(Size_type(max - min)));
last - first, rough_log_2_size(Size_type(max/2 - min/2)) + 1);
Div_type div_min = min >> log_divisor;
Div_type div_max = max >> log_divisor;
unsigned bin_count = unsigned(div_max - div_min) + 1;
Expand Down
4 changes: 2 additions & 2 deletions include/cpp-sort/probes/dis.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2022 Morwenn
* Copyright (c) 2016-2026 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_PROBES_DIS_H_
Expand Down Expand Up @@ -95,7 +95,7 @@ namespace probe
while (j <= i && not comp(proj(*lr_cummax[j - 1]), proj(*rl_min_it))
&& (j == 1 || not comp(proj(*rl_min_it), proj(*lr_cummax[j - 2])))) {
// Compute the next value of DM
res = std::max(res, i - j);
res = (std::max)(res, i - j);
// Compute the next value of RL
if (--i <= res) {
return res;
Expand Down
4 changes: 2 additions & 2 deletions include/cpp-sort/version.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2025 Morwenn
* Copyright (c) 2018-2026 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_VERSION_H_
Expand All @@ -9,6 +9,6 @@

#define CPPSORT_VERSION_MAJOR 1
#define CPPSORT_VERSION_MINOR 17
#define CPPSORT_VERSION_PATCH 1
#define CPPSORT_VERSION_PATCH 2

#endif // CPPSORT_VERSION_H_
14 changes: 5 additions & 9 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015-2025 Morwenn
# Copyright (c) 2015-2026 Morwenn
# SPDX-License-Identifier: MIT

include(cpp-sort-utils)
Expand Down Expand Up @@ -31,11 +31,9 @@ else()
UPDATE_DISCONNECTED 1
)
add_subdirectory(${Catch2_SOURCE_DIR} ${Catch2_BINARY_DIR})
mark_system_library(Catch2)
mark_system_library(Catch2WithMain)
list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras)

# Make Catch2::Catch2 a SYSTEM target
get_target_property(Catch2_INCLUDE_DIRECTORY Catch2 INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(Catch2 PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Catch2_INCLUDE_DIRECTORY}")
endif()
include(Catch)

Expand All @@ -57,10 +55,8 @@ else()

set(RC_INSTALL_ALL_EXTRAS ON)
add_subdirectory(${RapidCheck_SOURCE_DIR} ${RapidCheck_BINARY_DIR})

# Make rapidcheck a SYSTEM target
get_target_property(rapidcheck_INCLUDE_DIRECTORY rapidcheck INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(rapidcheck PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${rapidcheck_INCLUDE_DIRECTORY}")
mark_system_library(rapidcheck)
mark_system_library(rapidcheck_catch)
endif()

########################################
Expand Down