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
32 changes: 29 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,36 @@ jobs:
working-directory: test
run: cmake --build build --config Debug --target test -j100

# Windows check
test-on-windows:
# Windows-vs2026 check
test-on-windows-vs2026:
if: github.repository_owner == 'Kim-J-Smith'
runs-on: windows-latest
runs-on: windows-2025-vs2026
strategy:
matrix:
cpp_standards: [14, 17, 20, 23]
arch: [x64]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Config with C++${{ matrix.cpp_standards }}
working-directory: test
shell: bash
run: |
cmake -B build -S . \
-G "Visual Studio 18 2026" \
-A ${{ matrix.arch }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cpp_standards }}

- name: Build and test
working-directory: test
run: cmake --build build --config Debug --target test

# Windows-vs2022 check
test-on-windows-vs2022:
if: github.repository_owner == 'Kim-J-Smith'
runs-on: windows-2022
strategy:
matrix:
cpp_standards: [14, 17, 20, 23]
Expand Down
75 changes: 75 additions & 0 deletions benchmark/runtime/benchmark_std_op.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include "benchmark.hpp"

#include <functional>

static void std_op_wrapper_fn_std(picobench::state& s) {
auto less = std::less<int>{};
auto greater = std::greater<int>{};

auto f = [](std::function<bool(int, int)> f) { return f(0x111, 0x222); };

for (auto _ : s) {
volatile bool res1 = f(less);
volatile bool res2 = f(greater);
(void)res1; (void)res2;
}
}

static void std_op_wrapper_fn_ebd(picobench::state& s) {
auto less = std::less<int>{};
auto greater = std::greater<int>{};

auto f = [](ebd::fn<bool(int, int)> f) { return f(0x111, 0x222); };

for (auto _ : s) {
volatile bool res1 = f(less);
volatile bool res2 = f(greater);
(void)res1; (void)res2;
}
}

static void std_op_wrapper_fn_fu2(picobench::state& s) {
auto less = std::less<int>{};
auto greater = std::greater<int>{};

auto f = [](fu2::function<bool(int, int)> f) { return f(0x111, 0x222); };

for (auto _ : s) {
volatile bool res1 = f(less);
volatile bool res2 = f(greater);
(void)res1; (void)res2;
}
}

static void std_op_wrapper_fn_ref_ebd(picobench::state& s) {
auto less = std::less<int>{};
auto greater = std::greater<int>{};

auto f = [](ebd::fn_ref<bool(int, int)> f) { return f(0x111, 0x222); };

for (auto _ : s) {
volatile bool res1 = f(less);
volatile bool res2 = f(greater);
(void)res1; (void)res2;
}
}

static void std_op_wrapper_fn_view_fu2(picobench::state& s) {
auto less = std::less<int>{};
auto greater = std::greater<int>{};

auto f = [](fu2::function_view<bool(int, int)> f) { return f(0x111, 0x222); };

for (auto _ : s) {
volatile bool res1 = f(less);
volatile bool res2 = f(greater);
(void)res1; (void)res2;
}
}

BENCHMARK_UNIT(StdOperatorWrapper.FunctionWrapperAsParams);
BENCHMARK_BASELINE(std_op_wrapper_fn_std);
BENCHMARK_NOTBASE(std_op_wrapper_fn_fu2);
BENCHMARK_NOTBASE(std_op_wrapper_fn_ebd);
BENCHMARK_NOTBASE(std_op_wrapper_fn_view_fu2);
BENCHMARK_NOTBASE(std_op_wrapper_fn_ref_ebd);
14 changes: 10 additions & 4 deletions docs/release/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
## Fixed

- Fixed a constructor bug in `fn_ref`.
- Fixed a bug where `make_fn` failed to correctly deduce a `noexcept` functor.

- Fixed a bug in converting from `fn_ref` to `fn` / `unique_fn` / `safe_fn`.

## Changed

- `fn`, `unique_fn`, and `safe_fn` now use `is-callable-from` as the constraint, aligning with [func.wrap.move.ctor]/1. This tightens overload resolution and avoids incorrect constructor participation.
- **Lowered MSVC requirement to 19.20+** (previously required 19.34+).

- Improved ambiguity error diagnostics for `make_fn` when the callable is ambiguous.

- Enhanced the performance of `fn_ref`, `fn`, `unique_fn`, and `safe_fn`.

- Added negative compilation tests for the above constraints.
- `make_fn` now supports automatic deduction of callable objects with a `static operator()`.

## Notes

- `std::constant_wrapper` support is experimental as of v2.1.3.
- `std::constant_wrapper` support is experimental as of v2.1.4.
Loading