Skip to content

Commit a95bcb6

Browse files
authored
backport readme from original repo - cleanup boilerplate
- remove the identity boilerplate - drop in the un-merged readme content from original scope repo - indicate header only library
1 parent bc769ca commit a95bcb6

File tree

1 file changed

+22
-135
lines changed

1 file changed

+22
-135
lines changed

README.md

Lines changed: 22 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,41 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
88
![Continuous Integration Tests](https://github.com/bemanproject/scope/actions/workflows/ci_tests.yml/badge.svg)
99
![Lint Check (pre-commit)](https://github.com/bemanproject/scope/actions/workflows/pre-commit.yml/badge.svg)
1010

11-
## Overview
11+
# Overview
1212
During the C++20 cycle [P0052 Generic Scope Guard and RAII Wrapper for the Standard Library](https://wg21.link/P0052) added 4 types: `scope_exit`, `scope_fail`, `scope_success` and `unique_resource` to [LTFSv3](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4908#scopeguard). In the intervening time, two standard libraries have implemented support as well as Boost. With the imperative for safety and security in C++ developers need every tool in the toolbox. The authors believe it is time to move this facility into the standard. The paper will re-examine the five year old design and any learning from deployment of the LTFSv3.
1313

1414
For discussions of this library see:
1515
- [Discourse for discussion of scope](https://discourse.bemanproject.org/t/scope-library/315)
16-
17-
## Prior And Other Work
16+
# Prior And Other Work
17+
## Papers
1818
- TS design and wording paper [p0052 - Generic Scope Guard and RAII Wrapper for the Standard Library](https://wg21.link/p0052)
1919
- TS adoption paper [p1411 - Please reconsider <scope> for C++20](https://wg21.link/p1411)
20-
- pointer to GSL (todo)
20+
- [N3677 A Proposal to Add additional RAII Wrappers to the Standard Library](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3677.html)
21+
- [N4152 uncaught_exceptions - Sutter](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4152.pdf)
22+
23+
## Implementations
24+
- [GSL final_action](https://github.com/microsoft/GSL/blob/main/include/gsl/util) - part of core guidelins
2125
- [Boost.scope](https://www.boost.org/doc/libs/1_87_0/libs/scope/doc/html/index.html)
26+
- [scope_guard based on Andrei Alexandrescu and Petru Marginean article](https://ricab.github.io/scope_guard)
27+
28+
## Videos
29+
- [Peter Sommerlad - Woes of Scope Guards and Unique_Resource - 5+ years in the making](https://www.youtube.com/watch?v=O1sK__G5Nrg)
30+
- [Andrei Alexandrescu - Declarative Control Flow](https://www.youtube.com/watch?v=WjTrfoiB0MQ)
31+
2232
# Examples
2333
- [TS example of scope_exit](https://godbolt.org/z/T5KhTYjP7)
2434

2535
---
2636

27-
`beman.scope` is a minimal C++ library conforming to [The Beman Standard](https://github.com/bemanproject/beman/blob/main/docs/BEMAN_STANDARD.md).
28-
This can be used as a template for those intending to write Beman libraries.
29-
It may also find use as a minimal and modern C++ project structure.
37+
`beman.scope` is a C++ library conforming to [The Beman Standard](https://github.com/bemanproject/beman/blob/main/docs/BEMAN_STANDARD.md).
3038

31-
**Implements**: `std::identity` proposed in [Standard Library Concepts (P0898R3)](https://wg21.link/P0898R3).
39+
**Implements**: TODO
3240

3341
**Status**: [Under development and not yet ready for production use.](https://github.com/bemanproject/beman/blob/main/docs/BEMAN_LIBRARY_MATURITY_MODEL.md#under-development-and-not-yet-ready-for-production-use)
3442

3543
## Usage
3644

37-
`std::identity` is a function object type whose `operator()` returns its argument unchanged.
38-
`std::identity` serves as the default projection in constrained algorithms.
39-
Its direct usage is usually not needed.
45+
TODO
4046

4147
### Example Usage
4248

@@ -100,9 +106,7 @@ apt-get install \
100106

101107
### How to build beman.scope
102108

103-
This project strives to be as normal and simple a CMake project as possible.
104-
This build workflow in particular will work,
105-
producing a static `libbeman.scope.a` library, ready to package with its headers:
109+
Beman scope is header only.
106110

107111
```shell
108112
cmake --workflow --preset gcc-debug
@@ -125,126 +129,10 @@ Preset CMake variables:
125129
CMAKE_CXX_FLAGS="-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined"
126130
CMAKE_CXX_STANDARD="20"
127131

128-
-- The CXX compiler identification is GNU 11.4.0
129-
-- Detecting CXX compiler ABI info
130-
-- Detecting CXX compiler ABI info - done
131-
-- Check for working CXX compiler: /usr/bin/g++ - skipped
132-
-- Detecting CXX compile features
133-
-- Detecting CXX compile features - done
134-
-- The C compiler identification is GNU 11.4.0
135-
-- Detecting C compiler ABI info
136-
-- Detecting C compiler ABI info - done
137-
-- Check for working C compiler: /usr/bin/cc - skipped
138-
-- Detecting C compile features
139-
-- Detecting C compile features - done
140-
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter
141-
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
142-
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
143-
-- Found Threads: TRUE
144-
-- Configuring done
145-
-- Generating done
146-
-- Build files have been written to: /home/runner/work/scope/exemplar/build/gcc-debug
147-
148-
Executing workflow step 2 of 3: build preset "gcc-debug"
149-
150-
[1/14] Building CXX object src/beman/scope/CMakeFiles/beman.exemplar.dir/identity.cpp.o
151-
[2/14] Linking CXX static library src/beman/scope/libbeman.exemplar.a
152-
[3/14] Building CXX object examples/CMakeFiles/beman.scope.examples.identity_direct_usage.dir/identity_direct_usage.cpp.o
153-
[4/14] Linking CXX executable examples/beman.scope.examples.identity_direct_usage
154-
[5/14] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
155-
[6/14] Building CXX object src/beman/scope/CMakeFiles/beman.exemplar.tests.dir/identity.t.cpp.o
156-
[7/14] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
157-
[8/14] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
158-
[9/14] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
159-
[10/14] Linking CXX static library lib/libgtest.a
160-
[11/14] Linking CXX static library lib/libgtest_main.a
161-
[12/14] Linking CXX static library lib/libgmock.a
162-
[13/14] Linking CXX static library lib/libgmock_main.a
163-
[14/14] Linking CXX executable src/beman/scope/beman.exemplar.tests
164-
165-
Executing workflow step 3 of 3: test preset "gcc-debug"
166-
167-
Test project /home/runner/work/scope/exemplar/build/gcc-debug
168-
Start 1: IdentityTest.call_identity_with_int
169-
1/4 Test #1: IdentityTest.call_identity_with_int ........... Passed 0.13 sec
170-
Start 2: IdentityTest.call_identity_with_custom_type
171-
2/4 Test #2: IdentityTest.call_identity_with_custom_type ... Passed 0.01 sec
172-
Start 3: IdentityTest.compare_std_vs_beman
173-
3/4 Test #3: IdentityTest.compare_std_vs_beman ............. Passed 0.01 sec
174-
Start 4: IdentityTest.check_is_transparent
175-
4/4 Test #4: IdentityTest.check_is_transparent ............. Passed 0.01 sec
176-
177-
100% tests passed, 0 tests failed out of 4
178-
179-
Total Test time (real) = 0.18 sec
180-
181-
# Configure beman.scope via gcc-release workflow for direct usage.
182-
$ cmake --workflow --preset gcc-release
183-
Executing workflow step 1 of 3: configure preset "gcc-release"
184-
185-
Preset CMake variables:
186-
187-
CMAKE_BUILD_TYPE="RelWithDebInfo"
188-
CMAKE_CXX_COMPILER="g++"
189-
CMAKE_CXX_FLAGS="-O3"
190-
CMAKE_CXX_STANDARD="20"
191-
192-
-- The CXX compiler identification is GNU 11.4.0
193-
-- Detecting CXX compiler ABI info
194-
-- Detecting CXX compiler ABI info - done
195-
-- Check for working CXX compiler: /usr/bin/g++ - skipped
196-
-- Detecting CXX compile features
197-
-- Detecting CXX compile features - done
198-
-- The C compiler identification is GNU 11.4.0
199-
-- Detecting C compiler ABI info
200-
-- Detecting C compiler ABI info - done
201-
-- Check for working C compiler: /usr/bin/cc - skipped
202-
-- Detecting C compile features
203-
-- Detecting C compile features - done
204-
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter
205-
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
206-
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
207-
-- Found Threads: TRUE
208-
-- Configuring done
209-
-- Generating done
210-
-- Build files have been written to: /home/runner/work/scope/exemplar/build/gcc-release
211-
212-
Executing workflow step 2 of 3: build preset "gcc-release"
213-
214-
[1/14] Building CXX object src/beman/scope/CMakeFiles/beman.exemplar.dir/identity.cpp.o
215-
[2/14] Linking CXX static library src/beman/scope/libbeman.exemplar.a
216-
[3/14] Building CXX object examples/CMakeFiles/beman.scope.examples.identity_direct_usage.dir/identity_direct_usage.cpp.o
217-
[4/14] Linking CXX executable examples/beman.scope.examples.identity_direct_usage
218-
[5/14] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
219-
[6/14] Building CXX object src/beman/scope/CMakeFiles/beman.exemplar.tests.dir/identity.t.cpp.o
220-
[7/14] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
221-
[8/14] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
222-
[9/14] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
223-
[10/14] Linking CXX static library lib/libgtest.a
224-
[11/14] Linking CXX static library lib/libgtest_main.a
225-
[12/14] Linking CXX static library lib/libgmock.a
226-
[13/14] Linking CXX executable src/beman/scope/beman.exemplar.tests
227-
[14/14] Linking CXX static library lib/libgmock_main.a
228-
229-
Executing workflow step 3 of 3: test preset "gcc-release"
230-
231-
Test project /home/runner/work/scope/exemplar/build/gcc-release
232-
Start 1: IdentityTest.call_identity_with_int
233-
1/4 Test #1: IdentityTest.call_identity_with_int ........... Passed 0.00 sec
234-
Start 2: IdentityTest.call_identity_with_custom_type
235-
2/4 Test #2: IdentityTest.call_identity_with_custom_type ... Passed 0.00 sec
236-
Start 3: IdentityTest.compare_std_vs_beman
237-
3/4 Test #3: IdentityTest.compare_std_vs_beman ............. Passed 0.00 sec
238-
Start 4: IdentityTest.check_is_transparent
239-
4/4 Test #4: IdentityTest.check_is_transparent ............. Passed 0.00 sec
240-
241-
100% tests passed, 0 tests failed out of 4
242-
243-
Total Test time (real) = 0.01 sec
132+
TODO
244133

245134
# Run examples.
246-
$ build/gcc-release/examples/beman.scope.examples.identity_direct_usage
247-
2024
135+
$ TODO
248136

249137
```
250138

@@ -267,9 +155,8 @@ $ tree /opt/beman.scope
267155
├── include
268156
│   └── beman
269157
│   └── scope
270-
│   └── identity.hpp
271-
└── lib
272-
└── libbeman.scope.a
158+
│   └── scope.hpp
159+
273160

274161
4 directories, 2 files
275162
```

0 commit comments

Comments
 (0)