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
> 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
251
247
<br />
252
248
<br />
253
249
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.
-`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.
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`.
-`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.
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`.
-`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.
-`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.
Copy file name to clipboardExpand all lines: docs/dev_notes.md
+7-8Lines changed: 7 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,26 +4,25 @@ Here you can find the necessery information to be able to work on the project
4
4
5
5
<br />
6
6
7
-
## Building and testing
7
+
## Building and Testing
8
8
9
9
> [!NOTE]
10
10
> 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.
11
11
12
-
### Build the testing executable
12
+
### Build the testing executables
13
13
14
14
```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>
18
17
```
19
18
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.
0 commit comments