Conversation
and portable C++ feature checks
ab326ee to
f3c5c4a
Compare
3415d2e to
01a4dcf
Compare
This compiles with clang++-21 on OSX and should build on Windows too.
Pull Request Test Coverage Report for Build 22622218215Details
💛 - Coveralls |
Add more test for unique_resource
f827b5d to
2f5ab94
Compare
Note: Line coverage is only in range of about 95 - 97 % !bash-5.3$ make coverage
mkdir -p build/coverage
gcovr # XXX -v
(INFO) Reading coverage data...
(INFO) Writing coverage report...
lines: 95.3% (241 out of 253)
functions: 100.0% (173 out of 173)
branches: 49.8% (131 out of 263)
bash-5.3$ |
scope_exit does not need to be move-assignable!
add get_version() to CXX_MODULE to export some code;
350bcd8 to
1a86a99
Compare
This is needed if only an interface library is build
79cd72c to
f51bfa4
Compare
Prevent warning: placeholder variables are a C++2c extension
26120f1 to
7af734d
Compare
|
|
||
| #include <experimental/scope> //todo unconditional for unique_resource | ||
| // detect standard header first, then experimental, otherwise use local implementation | ||
| #if defined(__has_include) |
There was a problem hiding this comment.
This is c++17 feature so we don't need an existence check as the above code will already handle that we're 20+
| #include <experimental/scope> //todo unconditional for unique_resource | ||
| // detect standard header first, then experimental, otherwise use local implementation | ||
| #if defined(__has_include) | ||
| # if __has_include(<scope>) |
There was a problem hiding this comment.
No implementation has this header - so this isn't needed.
| # else | ||
| // no std scope header — fall through to local implementation below | ||
| # endif | ||
| #elif defined(__cpp_lib_scope) && __cpp_lib_scope >= 2023xxxxL |
| @@ -0,0 +1,330 @@ | |||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |||
There was a problem hiding this comment.
I'd really prefer the implementation to stay in scope.hpp
There was a problem hiding this comment.
Do I understand right: I should do git mv scope_impl.hpp scope.hpp ?
include/beman/scope/scope_impl.hpp
Outdated
| # error "C++20 or later is required" | ||
| #endif | ||
|
|
||
| // detect standard header first, then experimental, otherwise use local implementation |
There was a problem hiding this comment.
I think now is the time to use the local first and only use experimental on request - aka a cmake override
include/beman/scope/scope_impl.hpp
Outdated
| // Move assignment | ||
| constexpr auto operator=(scope_success&& other) noexcept(std::is_nothrow_move_assignable_v<F>) | ||
| -> scope_success& = delete; | ||
| #if MOVE_ASSIGNMENT_NEEDED |
There was a problem hiding this comment.
Lets use concepts -- in 2026 I don't want macros for this
There was a problem hiding this comment.
I have tried to test them, the move assignment does not work and is not needed I think.
|
My review is incomplete, but I'm out of time for now |
| // TODO(CK): missing usecase? | ||
| constexpr auto get_deleter() const noexcept -> Deleter; | ||
|
|
||
| // Helper to tests is_active() | ||
| // NOTE: check if active; not required from LWG? | ||
| constexpr explicit operator bool() const noexcept { return active; } |
86c2cfa to
c0e2002
Compare
Quickfix: do not use the old implementation Autoupdate pre-commit hooks
6475182 to
3d810f1
Compare
CMAKE_EXPERIMENTAL_CXX_IMPORT_STD is still needed Build and install always a header only lib Fix some clang-tidy warnings pre-commit autoupdate
743105f to
4a35cc4
Compare
This offers a portable implementation version that compiles on all OS with all C++23 compilers
import std;tooTODO:
DLLno lib foundgccon OSXclangDebug on CINOTE: This version compiles on OSX with apple-clang, llvm-clang, and g++-15 too!
Following Issues will be fixed:
unique_resourcebemanproject/scope#28I have been prepared export headers to test with DLL's on Windows too.
see https://discourse.cmake.org/t/linker-error-with-cxx-modules/15449