|
1 | | -# beman.inplace\_vector: A dynamically-resizable vector with fixed capacity and embedded storage |
2 | | - |
3 | 1 | <!-- |
4 | 2 | SPDX-License-Identifier: <SPDX License Expression> |
5 | 3 | --> |
| 4 | + |
| 5 | +# beman.inplace\_vector |
| 6 | + |
| 7 | +A dynamically-resizable vector with fixed capacity and embedded storage |
| 8 | + |
| 9 | +## Implements |
| 10 | + |
| 11 | +- [`inplace_vector` P0843R14](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p0843r14.html) |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +### Definition in P0843 |
| 16 | + |
| 17 | +> `inplace_vector` is a dynamically-resizable array with capacity fixed |
| 18 | +at compile time and contiguous inplace storage, |
| 19 | +that is, the array elements are stored within the vector object itself. |
| 20 | +Its API closely resembles `std::vector<T, A>`, |
| 21 | +making it easy to teach and learn, |
| 22 | +and the inplace storage guarantee makes it useful in environments in |
| 23 | +which dynamic memory allocations are undesired. |
| 24 | + |
| 25 | +### Code example |
| 26 | + |
| 27 | +```cpp |
| 28 | +// TODO: Add example |
| 29 | +``` |
| 30 | + |
| 31 | +## How to Build |
| 32 | + |
| 33 | +### Compiler support |
| 34 | + |
| 35 | +Building this repository requires **C++20** or later. |
| 36 | + |
| 37 | +### Dependencies |
| 38 | + |
| 39 | +TODO: tested platforms. |
| 40 | + |
| 41 | +### Instructions |
| 42 | + |
| 43 | +<!-- TODO: add preset support --> |
| 44 | + |
| 45 | +#### Manual CMake Build |
| 46 | + |
| 47 | +``` |
| 48 | +# Configure build |
| 49 | +$ cmake -S . -B build -DCMAKE_CXX_STANDARD=20 |
| 50 | +-- The CXX compiler identification is GNU 11.4.0 |
| 51 | +-- Detecting CXX compiler ABI info |
| 52 | +-- Detecting CXX compiler ABI info - done |
| 53 | +-- Check for working CXX compiler: /usr/bin/c++ - skipped |
| 54 | +-- Detecting CXX compile features |
| 55 | +-- Detecting CXX compile features - done |
| 56 | +-- Configuring done (0.4s) |
| 57 | +-- Generating done (0.0s) |
| 58 | +-- Build files have been written to: /.../inplace_vector/build |
| 59 | +
|
| 60 | +# Build |
| 61 | +$ cmake --build build |
| 62 | +[ 50%] Building CXX object src/beman/inplace_vector/tests/CMakeFiles/beman.inplace_vector.test.dir/inplace_vector.test.cpp.o |
| 63 | +[100%] Linking CXX executable beman.inplace_vector.test |
| 64 | +[100%] Built target beman.inplace_vector.test |
| 65 | +
|
| 66 | +# Run tests |
| 67 | +$ ctest --test-dir build/ |
| 68 | +Internal ctest changing into directory: /.../inplace_vector/build |
| 69 | +Test project /.../inplace_vector/build |
| 70 | + Start 1: beman.inplace_vector.test |
| 71 | +1/1 Test #1: beman.inplace_vector.test ........ Passed 0.00 sec |
| 72 | +
|
| 73 | +100% tests passed, 0 tests failed out of 1 |
| 74 | +
|
| 75 | +Total Test time (real) = 0.01 sec |
| 76 | +``` |
| 77 | + |
0 commit comments