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.optional` library aims to evaluate
12
-
the stability, the usability, and the performance of these proposed changes before they are officially adopted by WG21
13
-
into the C++ Working Draft. Additionally, it allows developers to use these new features before they are implemented in
14
-
major standard library compilers.
11
+
This repository implements `std::optional` extensions targeting C++26. The `beman.optional` 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.
15
12
16
13
**Implements**: [Give *std::optional* Range Support (P3168R2)](https://wg21.link/P3168R2) and [`std::optional<T&>` (P2988R5)](https://wg21.link/P2988R5)
17
14
@@ -27,11 +24,9 @@ Documentation and associated papers are licensed with the Creative Commons Attri
27
24
28
25
// SPDX-License-Identifier: CC-BY-4.0
29
26
30
-
The intent is that the source and documentation are available for use by people implementing their own optional types
31
-
as well as people using the optional presented here as-is.
27
+
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.
32
28
33
-
The README itself is licensed with CC0 1.0 Universal. Copy the contents and incorporate in your own work as you see
34
-
fit.
29
+
The README itself is licensed with CC0 1.0 Universal. Copy the contents and incorporate in your own work as you see fit.
35
30
36
31
// SPDX-License-Identifier: CC0-1.0
37
32
@@ -68,7 +63,7 @@ Full code can be found in [./examples/range_loop.cpp](./examples/range_loop.cpp)
68
63
### optional_ref
69
64
70
65
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
111
-
project has no C or C++ dependencies.
105
+
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.
112
106
113
107
Build-time dependencies:
114
108
@@ -128,14 +122,29 @@ apt-get install \
128
122
clang-18 clang++-18 clang-17 clang++-17
129
123
```
130
124
125
+
<details>
126
+
<summary> Build GoogleTest dependency from github.com </summary>
127
+
128
+
If you do not have GoogleTest installed on your development system, you may
129
+
optionally configure this project to download a known-compatible release of
The precise version of GoogleTest that will be used is maintained in
137
+
`./lockfile.json`.
138
+
139
+
</details>
140
+
131
141
### Instructions
132
142
133
143
Full set of supported toolchains can be found in [.github/workflows/ci.yml](.github/workflows/ci.yml).
134
144
135
145
#### Preset CMake Flows
136
146
137
-
This project strives to be as normal and simple a CMake project as possible. This build workflow in particular will
138
-
work, producing a static `beman_optional` library, ready to package:
147
+
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_optional` library, ready to package:
139
148
140
149
```shell
141
150
# List available preset configurations:
@@ -238,14 +247,9 @@ No tests were found!!!
238
247
239
248
#### Pre-Commit for Linting
240
249
241
-
Various linting tools are configured and installed via the [pre-commit](https://pre-commit.com/) framework. This
242
-
requires a working python environment, but also allows the tools, such as clang-format and cmake-lint, to be versioned
243
-
on a per project basis rather than being installed globally. Version changes in lint checks often means differences in
244
-
success or failure between the versions in CI and the versions used by a developer. By using the same configurations,
245
-
this problem is avoided.
250
+
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.
246
251
247
-
In order to set up a python environment, using a python virtual environment can simplify maintaining different
248
-
configurations between projects. There is no particular dependency on a particular python3 version.
252
+
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.
249
253
250
254
##### Creating and configuring a venv
251
255
@@ -258,8 +262,7 @@ python3 -m venv .venv
258
262
. .venv/bin/activate &&exec bash
259
263
```
260
264
261
-
This will create the venv, install the python and python development tools, and run bash with the PATH and other
262
-
environment variables set to use the venv preferentially.
265
+
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.
263
266
264
267
##### Running the linting tools
265
268
@@ -291,3 +294,4 @@ Latest revision(s) of the papers can be built / found at:
0 commit comments