You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository implements `std::optional` extensions targeting C++26. The `beman.optional26` library aims to evaluate the stability, the usability, and the performance of these proposed changes before they are officially adopted by WG21 into the C++ Working Draft. Additionally, it allows developers to use these new features before they are implemented in major standard library compilers.
9
+
This repository implements `std::optional` extensions targeting C++26. The `beman.optional26` library aims to evaluate
10
+
the stability, the usability, and the performance of these proposed changes before they are officially adopted by WG21
11
+
into the C++ Working Draft. Additionally, it allows developers to use these new features before they are implemented in
12
+
major standard library compilers.
10
13
11
14
**Implements**:
12
15
@@ -41,9 +44,11 @@ Documentation and associated papers are licensed with the Creative Commons Attri
41
44
42
45
// SPDX-License-Identifier: CC-BY-4.0
43
46
44
-
The intent is that the source and documentation are available for use by people implementing their own optional types as well as people using the optional presented here as-is.
47
+
The intent is that the source and documentation are available for use by people implementing their own optional types
48
+
as well as people using the optional presented here as-is.
45
49
46
-
The README itself is licensed with CC0 1.0 Universal. Copy the contents and incorporate in your own work as you see fit.
50
+
The README itself is licensed with CC0 1.0 Universal. Copy the contents and incorporate in your own work as you see
51
+
fit.
47
52
48
53
// SPDX-License-Identifier: CC0-1.0
49
54
@@ -53,7 +58,7 @@ Full runable examples can be found in `examples/` - please check [./examples/REA
53
58
54
59
### range_loop
55
60
56
-
The next code snippet shows optional range support added in [Give *std::optional* Range Support(P3168R2)](https://wg21.link/P3168R2):
61
+
The next code snippet shows optional range support added in [Give *std::optional* Range Support(P3168R2)](https://wg21.link/P3168R2):
57
62
58
63
```cpp
59
64
#include<Beman/Optional26/optional.hpp>
@@ -74,11 +79,13 @@ for (const auto& i : opt) {
74
79
}
75
80
```
76
81
77
-
Full code can be found in [./examples/range_loop.cpp](./examples/range_loop.cpp). Build and run instructions in [./examples/README.md](./examples/README.md). Or [try it on Compiler Explorer](https://godbolt.org/z/b5ThEqqhf).
82
+
Full code can be found in [./examples/range_loop.cpp](./examples/range_loop.cpp). Build and run instructions in
83
+
[./examples/README.md](./examples/README.md). Or [try it on Compiler Explorer](https://godbolt.org/z/b5ThEqqhf).
78
84
79
85
### optional_ref
80
86
81
-
The next code snippet shows optional reference support added in [`std::optional<T&>` (P2988R5)](https://wg21.link/P2988R5):
87
+
The next code snippet shows optional reference support added in [`std::optional<T&>`
This project is mainly tested on `Ubuntu 22.04` and `Ubuntu 24.04`, but it should be as portable as CMake is. This project has no C or C++ dependencies.
127
+
This project is mainly tested on `Ubuntu 22.04` and `Ubuntu 24.04`, but it should be as portable as CMake is. This
128
+
project has no C or C++ dependencies.
121
129
122
130
Build-time dependencies:
123
131
@@ -143,7 +151,8 @@ Full set of supported toolchains can be found in [.github/workflows/ci.yml](.git
143
151
144
152
#### Preset CMake Flows
145
153
146
-
This project strives to be as normal and simple a CMake project as possible. This build workflow in particular will work, producing a static `beman_optional26` library, ready to package:
154
+
This project strives to be as normal and simple a CMake project as possible. This build workflow in particular will
155
+
work, producing a static `beman_optional26` library, ready to package:
147
156
148
157
```shell
149
158
# List available preset configurations:
@@ -194,7 +203,10 @@ CI current build and test flows:
194
203
195
204
```shell
196
205
# Configure build: default build production code + tests (BUILD_TESTING=ON by default).
-- The CXX compiler identification is Clang 19.0.0
225
241
...
226
242
-- Build files have been written to: /path/to/Optional26/.build
@@ -238,11 +254,18 @@ No tests were found!!!
238
254
```
239
255
240
256
#### Pre-Commit for Linting
241
-
Various linting tools are configured and installed via the [pre-commit](https://pre-commit.com/) framework. This requires a working python environment, but also allows the tools, such as clang-format and cmake-lint, to be versioned on a per project basis rather than being installed globally. Version changes in lint checks often means differences in success or failure between the versions in CI and the versions used by a developer. By using the same configurations, this problem is avoided.
242
257
243
-
In order to set up a python environment, using a python virtual environment can simplify maintaining different configurations between projects. There is no particular dependency on a particular python3 version.
258
+
Various linting tools are configured and installed via the [pre-commit](https://pre-commit.com/) framework. This
259
+
requires a working python environment, but also allows the tools, such as clang-format and cmake-lint, to be versioned
260
+
on a per project basis rather than being installed globally. Version changes in lint checks often means differences in
261
+
success or failure between the versions in CI and the versions used by a developer. By using the same configurations,
262
+
this problem is avoided.
263
+
264
+
In order to set up a python environment, using a python virtual environment can simplify maintaining different
265
+
configurations between projects. There is no particular dependency on a particular python3 version.
This will create the venv, install the python and python development tools, and run bash with the PATH and other environment variables set to use the venv preferentially.
278
+
This will create the venv, install the python and python development tools, and run bash with the PATH and other
279
+
environment variables set to use the venv preferentially.
256
280
257
281
##### Running the linting tools
282
+
258
283
```shell
259
284
pre-commit run -a
260
285
```
@@ -271,7 +296,8 @@ make lint
271
296
272
297
Latest revision(s) of the papers can be built / found at:
273
298
274
-
*[give-std-optional-range-support](https://github.com/neatudarius/give-std-optional-range-support/) for `Give *std::optional* Range Support (P3168)`
299
+
*[give-std-optional-range-support](https://github.com/neatudarius/give-std-optional-range-support/) for
0 commit comments