Skip to content

Commit 6e01b78

Browse files
committed
docs cleanup - part 1
1 parent 8854265 commit 6e01b78

7 files changed

Lines changed: 133 additions & 342 deletions

File tree

docs/core_util_types.md

Lines changed: 0 additions & 255 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ This section describes a set of fundamental types provided by the library. While
99
- [Common type traits](#common-type-traits)
1010
- [General type aliases](#general-type-aliases)
1111
- [Graph element property types](#graph-element-property-types)
12-
- [Iterator-related types](#iterator-related-types)
1312
- [I/O types](#io-types)
1413

1514
<br />
@@ -33,9 +32,6 @@ The table below contains the basic type aliases defined in the library.
3332
| `size_type` | `std::uint64_t` |
3433
| `id_type` | `size_type` |
3534
| `homogeneous_pair<T>` | `std::pair<T, T>` |
36-
| `optional_ref<T>` | `std::optional<std::reference_wrapper<std::remove_reference_t<T>>>` |
37-
| `optional_cref` | `std::optional<std::reference_wrapper<const std::remove_cvref_t<T>>>` |
38-
| `const_ref_wrap` | `std::reference_wrapper<const T>` |
3935

4036
> [!NOTE]
4137
> All types in the table above are defined in the `gl::types` namespace and in the [gl/types/types.hpp](/include/gl/types/types.hpp) header file.
@@ -251,257 +247,6 @@ This section describes the type traits that are associated with the property typ
251247
<br />
252248
<br />
253249
254-
## Iterator-related types
255-
256-
This section provides the description of types used to manage range/collection iterators.
257-
258-
### `class iterator_range`
259-
260-
- *Description*:
261-
The `iterator_range` class is a wrapper around a pair of forward iterators, providing a range interface with optional caching behavior. It allows for efficient iteration over a range of elements, with different caching strategies based on the specified `CacheMode`.
262-
263-
- *Template parameters*:
264-
- `Iterator: std::forward_iterator` - A type that meets the requirements of a forward iterator.
265-
- `CacheMode: type_traits::c_cache_mode` - A type trait that defines the caching strategy.
266-
**NOTE:** The `CacheMode` parameter can be one of the following: `gl::type_traits::{no_cache,lazy_cache,eager_cache}`
267-
268-
> [!IMPORTANT]
269-
> The default caching strategy for the `iterator_range` class can be set using the following macros:
270-
>
271-
> - `GL_CONFIG_IT_RANGE_DEFAULT_CACHE_MODE_EAGER` - default strategy set to `gl::type_traits::eager_cache`
272-
> - `GL_CONFIG_IT_RANGE_DEFAULT_CACHE_MODE_LAZY` - default strategy set to `gl::type_traits::lazy_cache`
273-
> - `GL_CONFIG_IT_RANGE_DEFAULT_CACHE_MODE_NONE` - default strategy set to `gl::type_traits::no_cache`
274-
275-
- *Type definitions*:
276-
- `iterator` - The type of the iterator.
277-
- `const_iterator` - The type of the constant iterator **(for C++23 or newer)**.
278-
- `distance_type` - The type used for representing the distance between iterators (`std::ptrdiff_t`).
279-
- `value_type` - The type of the elements in the range (equivalent to `std::remove_reference_t<typename iterator::value_type>`).
280-
- `cache_mode` - The caching strategy used in the range (an alias for `CacheMode`).
281-
282-
- *Constructors*:
283-
- `iterator_range(iterator begin, iterator end)` - Initializes the iterator range using the specified caching strategy.
284-
- `iterator_range(const iterator_range&)` - Copy constructor (*default*).
285-
- `iterator_range(iterator_range&&)` - Move constructor (*default*).
286-
287-
- *Assignment operators*:
288-
- `operator=(const iterator_range&)` - Copy assignment operator (*default*).
289-
- `operator=(iterator_range&&)` - Move assignment operator (*default*).
290-
291-
- *Destructor*:
292-
- `~iterator_range()` - Destructor (*default*).
293-
294-
- *Member functions*:
295-
- `begin() const -> iterator` - Returns an iterator to the beginning of the range.
296-
- `end() const -> iterator` - Returns an iterator to the end of the range.
297-
- `cbegin() const -> auto` - Returns a constant iterator to the beginning of the range **(for C++23 or newer)**.
298-
- `cend() const -> auto` - Returns a constant iterator to the end of the range **(for C++23 or newer)**.
299-
- `distance() const -> distance_type` - Returns the number of elements in the range, computed based on the caching strategy.
300-
- `element_at(types::size_type position) -> value_type&` - Returns a reference to the element at the specified position.
301-
- `element_at(types::size_type position) const -> const value_type&` - Returns a reference to the element at the specified position.
302-
- `operator[](types::size_type position) -> value_type&` - Provides access to the element at the specified position (equivalent to `element_at`).
303-
- `operator[](types::size_type position) const -> const value_type&` - Provides access to the element at the specified position (equivalent to `element_at`).
304-
305-
> [!IMPORTANT]
306-
> The `iterator_range` class is marked `final` by default. To use this class as a base class you have to add:
307-
>
308-
> ```cpp
309-
> #define GL_CONFIG_IT_RANGE_NOT_FINAL
310-
> ```
311-
>
312-
> in your program or add a `-DGL_CONFIG_IT_RANGE_NOT_FINAL` flag when compiling.
313-
314-
#### Associated functions
315-
316-
- `gl::make_iterator_range(begin, end)`
317-
- *Description*: Creates an `iterator_range` from the given iterators using the specified caching strategy.
318-
- *Template parameters*:
319-
- `Iterator: std::forward_iterator` - The iterator type.
320-
- `CacheMode: type_traits::c_cache_mode` - The caching strategy.
321-
- *Parameters*:
322-
- `begin: Iterator` - the begin iterator
323-
- `end: Iterator` - the end iterator
324-
- *Return type*: `types::iterator_range<Iterator, CacheMode>`
325-
326-
- `gl::make_iterator_range(range)`
327-
- *Description*: Creates an `iterator_range` from the given range using its `begin` and `end` iterators and with the specified caching strategy
328-
- *Template parameters*:
329-
- `Range: c_range` - The range type.
330-
- `CacheMode: type_traits::c_cache_mode` - The caching strategy.
331-
- *Parameters*:
332-
- `range: Range&` - the range used to create the `iterator_range`
333-
- *Return type*: `types::iterator_range<typename Range::iterator, CacheMode>`
334-
335-
- `gl::make_const_iterator_range(range)`
336-
- *Description*: Creates an `iterator_range` from the given range using its `cbegin` and `cend` iterators and with the specified caching strategy
337-
- *Template parameters*:
338-
- `Range: c_range` - The range type.
339-
- `CacheMode: type_traits::c_cache_mode` - The caching strategy.
340-
- *Parameters*:
341-
- `range: const Range&` - the range used to create the `iterator_range`
342-
- *Return type*: `types::iterator_range<typename Range::const_iterator, CacheMode>`
343-
344-
<br />
345-
346-
### `class dereferencing_iterator`
347-
348-
- *Description*:
349-
The `dereferencing_iterator` class is a wrapper around a forward iterator that dereferences its elements, providing direct access to the underlying objects managed by strong pointer types. This iterator enables seamless iteration over collections of pointer elements.
350-
351-
- *Template parameters*:
352-
- `Iterator: std::forward_iterator` - A type that meets the requirements of a forward iterator and points to strong pointer types.
353-
354-
- *Constraints*:
355-
- `type_traits::c_strong_ptr<typename Iterator::value_type>` - The iterator's value type must be a strong (raw, unique, shared) pointer type.
356-
357-
- *Type definitions*:
358-
- `iterator_type` - The type of the underlying iterator.
359-
- `value_type` - The type of the elements pointed to by the strong pointers (defined as `type_traits::ptr_element_type_t<iterator_value_type>`).
360-
- `reference` - A reference type to the dereferenced value (`value_type&`).
361-
- `pointer` - A pointer type to the dereferenced value (`value_type*`).
362-
- `difference_type` - The type used for representing the distance between iterators (inferred from `iterator_type`).
363-
- `iterator_category` - The iterator category inferred from `iterator_type`.
364-
365-
- *Constructors*:
366-
- `dereferencing_iterator() = default` - Default constructor.
367-
- `dereferencing_iterator(iterator_type it)` - Initializes the iterator with the specified iterator.
368-
- `dereferencing_iterator(const dereferencing_iterator&) = default` - Copy constructor (*default*).
369-
- `dereferencing_iterator(dereferencing_iterator&&) = default` - Move constructor (*default*).
370-
371-
- *Assignment operators*:
372-
- `dereferencing_iterator& operator=(const dereferencing_iterator&) = default` - Copy assignment operator (*default*).
373-
- `dereferencing_iterator& operator=(dereferencing_iterator&&) = default` - Move assignment operator (*default*).
374-
375-
- *Member functions*:
376-
- `operator*() const -> reference` - Dereferences the iterator, returning a reference to the underlying value.
377-
- `operator->() const -> pointer` - Returns a pointer to the underlying value, handling strong smart pointer types appropriately.
378-
- `operator++() -> dereferencing_iterator&` - Prefix increment operator; advances the iterator.
379-
- `operator++(int) -> dereferencing_iterator` - Postfix increment operator; advances the iterator and returns a copy of the previous state.
380-
- `operator--() -> dereferencing_iterator&` (requires `std::bidirectional_iterator`) - Prefix decrement operator; moves the iterator backward.
381-
- `operator--(int) -> dereferencing_iterator` (requires `std::bidirectional_iterator`) - Postfix decrement operator; moves the iterator backward and returns a copy of the previous state.
382-
- `operator==(const dereferencing_iterator& other) const -> bool` - Compares two dereferencing iterators for equality.
383-
- `operator!=(const dereferencing_iterator& other) const -> bool` - Compares two dereferencing iterators for inequality.
384-
- `base() const -> iterator_type` - Returns the underlying iterator.
385-
386-
#### Associated functions
387-
388-
- `gl::deref_begin(Range& range)`
389-
- *Description*: Returns a `dereferencing_iterator` pointing to the beginning of the specified range.
390-
- *Template parameters*:
391-
- `Range: c_range` - The range type.
392-
- *Parameters*:
393-
- `range: Range&` - The range from which to obtain the beginning iterator.
394-
- *Return type*: `types::dereferencing_iterator<decltype(std::ranges::begin(range))>`
395-
396-
- `gl::deref_end(Range& range)`
397-
- *Description*: Returns a `dereferencing_iterator` pointing to the end of the specified range.
398-
- *Template parameters*:
399-
- `Range: c_range` - The range type.
400-
- *Parameters*:
401-
- `range: Range&` - The range from which to obtain the end iterator.
402-
- *Return type*: `types::dereferencing_iterator<decltype(std::ranges::end(range))>`
403-
404-
- `gl::deref_cbegin(const Range& range)`
405-
- *Description*: Returns a `dereferencing_iterator` pointing to the constant beginning of the specified range.
406-
- *Template parameters*:
407-
- `Range: c_const_range` - The constant range type.
408-
- *Parameters*:
409-
- `range: const Range&` - The range from which to obtain the constant beginning iterator.
410-
- *Return type*: `types::dereferencing_iterator<decltype(std::ranges::cbegin(range))>`
411-
412-
- `gl::deref_cend(const Range& range)`
413-
- *Description*: Returns a `dereferencing_iterator` pointing to the constant end of the specified range.
414-
- *Template parameters*:
415-
- `Range: c_const_range` - The constant range type.
416-
- *Parameters*:
417-
- `range: const Range&` - The range from which to obtain the constant end iterator.
418-
- *Return type*: `types::dereferencing_iterator<decltype(std::ranges::cend(range))>`
419-
420-
<br />
421-
422-
### `class non_null_iterator`
423-
424-
- *Description*:
425-
The `non_null_iterator` class is a wrapper around a forward iterator that skips null elements (i.e., null pointers) during iteration. This iterator is particularly useful when working with collections of pointers where you want to ignore any null values seamlessly.
426-
427-
- *Template parameters*:
428-
- `Iterator: std::forward_iterator` - A type that meets the requirements of a forward iterator and points to strong pointer types.
429-
430-
- *Constraints*:
431-
- `type_traits::c_strong_ptr<typename Iterator::value_type>` - The iterator's value type must be a strong (raw, unique, shared) pointer type.
432-
433-
- *Type definitions*:
434-
- `iterator_type` - The type of the underlying iterator.
435-
- `value_type` - The type of the elements pointed to by the strong pointers (inferred from `iterator_type`).
436-
- `reference` - The reference type of the elements in the underlying iterator (`typename std::iterator_traits<iterator_type>::reference`).
437-
- `pointer` - The pointer type of the elements in the underlying iterator (`typename std::iterator_traits<iterator_type>::pointer`).
438-
- `difference_type` - The type used for representing the distance between iterators (inferred from `iterator_type`).
439-
- `iterator_category` - The iterator category inferred from `iterator_type`.
440-
441-
- *Constructors*:
442-
- `non_null_iterator() = default` - Default constructor.
443-
- `non_null_iterator(iterator_type current, iterator_type end)` (for non-bidirectional iterators) - Initializes the iterator with the specified current and end iterators, skipping initial null elements if necessary.
444-
- `non_null_iterator(iterator_type begin, iterator_type current, iterator_type end)` (for bidirectional iterators) - Initializes the iterator with specified begin, current, and end iterators, skipping initial null elements if necessary.
445-
- `non_null_iterator(const non_null_iterator&) = default` - Copy constructor (*default*).
446-
- `non_null_iterator(non_null_iterator&&) = default` - Move constructor (*default*).
447-
448-
- *Assignment operators*:
449-
- `non_null_iterator& operator=(const non_null_iterator&) = default` - Copy assignment operator (*default*).
450-
- `non_null_iterator& operator=(non_null_iterator&&) = default` - Move assignment operator (*default*).
451-
452-
- *Member functions*:
453-
- `operator*() const -> reference` - Dereferences the iterator, returning a reference to the underlying non-null value.
454-
- `operator->() const -> pointer` - Returns a pointer to the underlying non-null value.
455-
- `operator++() -> non_null_iterator&` - Prefix increment operator; advances the iterator and skips any subsequent null elements.
456-
- `operator++(int) -> non_null_iterator` - Postfix increment operator; advances the iterator and skips any subsequent null elements, returning a copy of the previous state.
457-
- `operator--() -> non_null_iterator&` (requires `std::bidirectional_iterator`) - Prefix decrement operator; moves the iterator backward and skips any null elements.
458-
- `operator--(int) -> non_null_iterator` (requires `std::bidirectional_iterator`) - Postfix decrement operator; moves the iterator backward and skips any null elements, returning a copy of the previous state.
459-
- `operator==(const non_null_iterator& other) const -> bool` - Compares two non-null iterators for equality.
460-
- `operator!=(const non_null_iterator& other) const -> bool` - Compares two non-null iterators for inequality.
461-
- `base() const -> iterator_type` - Returns the current underlying iterator.
462-
463-
- *Private member functions*:
464-
- `_is_null(const reference& ptr) -> bool` - Checks if the given pointer is null.
465-
- `_skip_null_elements_forward()` - Advances the current iterator past any null elements in the forward direction.
466-
- `_skip_null_elements_backward()` (requires `std::bidirectional_iterator`) - Advances the current iterator past any null elements in the backward direction.
467-
468-
#### Associated functions
469-
470-
- `gl::non_null_begin(Range& range)`
471-
- *Description*: Returns a `non_null_iterator` pointing to the beginning of the specified range while skipping null elements.
472-
- *Template parameters*:
473-
- `Range: c_range` - The range type.
474-
- *Parameters*:
475-
- `range: Range&` - The range from which to obtain the beginning iterator.
476-
- *Return type*: `types::non_null_iterator<decltype(std::ranges::begin(range))>`
477-
478-
- `gl::non_null_end(Range& range)`
479-
- *Description*: Returns a `non_null_iterator` pointing to the end of the specified range while skipping null elements.
480-
- *Template parameters*:
481-
- `Range: c_range` - The range type.
482-
- *Parameters*:
483-
- `range: Range&` - The range from which to obtain the end iterator.
484-
- *Return type*: `types::non_null_iterator<decltype(std::ranges::end(range))>`
485-
486-
- `gl::non_null_cbegin(const Range& range)`
487-
- *Description*: Returns a `non_null_iterator` pointing to the constant beginning of the specified range while skipping null elements.
488-
- *Template parameters*:
489-
- `Range: c_const_range` - The constant range type.
490-
- *Parameters*:
491-
- `range: const Range&` - The range from which to obtain the constant beginning iterator.
492-
- *Return type*: `types::non_null_iterator<decltype(std::ranges::cbegin(range))>`
493-
494-
- `gl::non_null_cend(const Range& range)`
495-
- *Description*: Returns a `non_null_iterator` pointing to the constant end of the specified range while skipping null elements.
496-
- *Template parameters*:
497-
- `Range: c_const_range` - The constant range type.
498-
- *Parameters*:
499-
- `range: const Range&` - The range from which to obtain the constant end iterator.
500-
- *Return type*: `types::non_null_iterator<decltype(std::ranges::cend(range))>`
501-
502-
<br />
503-
<br />
504-
505250
## I/O types
506251
507252
This section provides the description of I/O types and utility defined in the library.

docs/dev_notes.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,25 @@ Here you can find the necessery information to be able to work on the project
44

55
<br />
66

7-
## Building and testing
7+
## Building and Testing
88

99
> [!NOTE]
1010
> 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.
1111
12-
### Build the testing executable
12+
### Build the testing executables
1313

1414
```shell
15-
cmake -B build
16-
cd build
17-
make # -j <n>
15+
cmake -B build -DBUILD_TESTS=ON
16+
cmake --build build # -j<n>
1817
```
1918

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

2221
### Run the tests
2322

2423
```shell
25-
cd build
26-
./tests/run # -ts=<test-suite-name>
24+
./build/tests/gl # -ts=<test-suite-name>
25+
./build/tests/hgl # -ts=<test-suite-name>
2726
```
2827

2928
> [!NOTE]

0 commit comments

Comments
 (0)