Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ The instructions and requirements of working on the `CPP-GL` project can be foun

## Compiler support

<!--TODO: verify whether the min compiler version is correct for C++23-->
| Compiler | Min version |
| :-: | :-: |
| GNU G++ | 14 |
Expand Down
42 changes: 42 additions & 0 deletions docs/additional_functionality.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Additional functionality

- [Force inlining](#force-inlining)
- [Ranges utility](#ranges-utility)

<br />

Expand All @@ -16,3 +17,44 @@ To enable the force inlining functionality you have to add the following in your

> [!NOTE]
> Force inlining is supported only for the GNU G++ and CLang++ compilers.

<br />
<br />

## Ranges utility

Small helpers for working with C++20 ranges.

> [!NOTE]
> - Header: [gl/util/ranges.hpp](/include/gl/util/ranges.hpp)
> - Namespace: `gl::util`

### View adapters

- **`deref_view`**
- *Description*: A transform view that dereferences pointer-like elements in a range. Useful for turning a range of pointers or smart pointers into a range of references.
- *Usage*: `range | gl::util::deref_view`
- *Works with*: `T*`, `std::unique_ptr<T>`, `std::shared_ptr<T>`, and generally pointer-like objects supporting unary `*`.
- *Return type*: A lazy transformed view whose reference type is `decltype(*p)` of the underlying elements.
- *Example*:
```cpp
std::vector<std::unique_ptr<int>> v; /* ... */
for (int& x : v | gl::util::deref_view) {
// use x as an int&
}
```

### Functions

- **`range_size(r)`**
- *Template parameters*:
- `R: std::ranges::range`
- *Description*: Returns the size of a range. If `R` models `std::ranges::sized_range`, it forwards to `std::ranges::size(r)` in O(1). Otherwise, it computes `std::ranges::distance(std::begin(r), std::end(r))` in O(n).
- *Parameters*:
- `r: R&&` – the input range.
- *Return type*: Same type as produced by `std::ranges::size(r)` for sized ranges or `std::ranges::distance(...)` otherwise.
- *Complexity*: O(1) for sized ranges; O(n) otherwise.
- *Exceptions*: No specific exceptions; propagates iterator operations if they throw.

> [!CAUTION]
> For non-sized, single-pass/input ranges `range_size` will consume the range when computing distance.
13 changes: 1 addition & 12 deletions docs/algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,6 @@ This section covers the specific types and type traits used for the algorithm im
- `id: types::id_type` - the ID of the vertex.
- `source_id: types::id_type` - the ID of the source vertex, typically used during algorithms.

- `edge_info`
- *Description*: Holds information about an edge, including the edge itself and its source vertex's ID.
- *Template parameters*:
- `EdgeType: type_traits::c_instantiation_of<edge_descriptor>` - the type of the edge.
- *Constructors*:
- `vertex_info(types::id_type id)` - initializes the object with the same value for `id` and `source_id` representing a starting vertex
- `vertex_info(types::id_type id, types::id_type source_id)`
- *Member variables*:
- `edge: types::const_ref_wrap<EdgeType>` - a constant reference wrapper for the edge.
- `source_id: types::id_type` - the ID of the source vertex of the held edge.

- `predicate_result`
- *Description*: Represents the result of a predicate evaluation.
- *Type definitions*:
Expand Down Expand Up @@ -383,7 +372,7 @@ This section covers the specific types and type traits used for the algorithm im
> - *Constructors*:
> - `mst_descriptor(types::size_type n_vertices)` - Initializes an empty `edges` list with the capacity of $\text{n-vertices} - 1$ and the total weight is set to $0$.
> - *Member variables*:
> - `edges: std::vector<types::const_ref_wrap<edge_type>>` - A list of constant edge references representing the edges of the spanning tree.
> - `edges: std::vector<edge_type>` - A list of edges of the spanning tree.
> - `weight: weight_type` - The total weight of all edges of the spanning tree.

<br />
Expand Down
255 changes: 0 additions & 255 deletions docs/core_util_types.md

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@ Here you can find the necessery information to be able to work on the project

<br />

## Building and testing
## Building and Testing

> [!NOTE]
> The project uses [doctest](https://github.com/doctest/doctest) framework for unit testing, however it is already installed in the [tests/external](/tests/external/) directory, so there is no need to install it sepparately.

### Build the testing executable
### Build the testing executables

```shell
cmake -B build
cd build
make # -j <n>
cmake -B build -DBUILD_TESTS=ON
cmake --build build # -j<n>
```

This will build the test executable `run` in the `<project-root>/build/tests` directory.
This will build the test executables `gl` (GL module tests) and `hgl` (HGL module tests) in the `<project-root>/build/tests` directory.

### Run the tests

```shell
cd build
./tests/run # -ts=<test-suite-name>
./build/tests/gl # -ts=<test-suite-name>
./build/tests/hgl # -ts=<test-suite-name>
```

> [!NOTE]
Expand Down
Loading