Skip to content

Commit

Permalink
add comment on algorithms and ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
m-fila committed May 9, 2024
1 parent 3e20c9f commit b597adf
Showing 1 changed file with 5 additions and 148 deletions.
153 changes: 5 additions & 148 deletions doc/collections_as_container.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,151 +144,8 @@ The PODIO Collections currently are not checked against expression and statement

## Collection and standard algorithms

### Non-modifying sequence operations

| Algorithm | Compatible with Collection? | Comment |
| ----------|-----------------------------|---------|
| `std::all_of` | | |
| `std::any_of` | | |
| `std::none_of` | | |
| `std::for_each` | | |
| `std::for_each_n` | | |
| `std::count` | | |
| `std::count_if` | | |
| `std::mismatch` | | |
| `std::find` | | |
| `std::find_if` | | |
| `std::find_if_not` | | |
| `std::find_end` | | |
| `std::find_first_of` | | |
| `std::adjacent_find` | | |
| `std::search` | | |
| `std::search_n` | | |

### Modifying sequence operations

| Algorithm | Compatible with Collection? | Comment |
|----------------------|-----------------------------|---------|
| `std::copy` | | |
| `std::copy_if` | | |
| `std::copy_n` | | |
| `std::copy_backward` | | |
| `std::move` | | |
| `std::move_backward` | | |
| `std::fill` | | |
| `std::fill_n` | | |
| `std::transform` | | |
| `std::generate` | | |
| `std::generate_n` | | |
| `std::remove` | | |
| `std::remove_if` | | |
| `std::remove_copy` | | |
| `std::remove_copy_if` | | |
| `std::replace` | | |
| `std::replace_if` | | |
| `std::replace_copy` | | |
| `std::replace_copy_if` | | |
| `std::swap` | | |
| `std::swap_ranges` | | |
| `std::iter_swap` | | |
| `std::reverse` | | |
| `std::reverse_copy` | | |
| `std::rotate` | | |
| `std::rotate_copy` | | |
| `std::shift_left` | | |
| `std::shift_right` | | |
| `std::random_shuffle` | | |
| `std::shuffle` | | |
| `std::sample` | | |
| `std::unique` | | |
| `std::unique_copy` | | |

### Partitioning Operations

| Algorithm | Compatible with Collection? | Comment |
|----------------------|-----------------------------|---------|
| `std::is_partitioned` | | |
| `std::partition` | | |
| `std::partition_copy` | | |
| `std::stable_partition` | | |
| `std::partition_point` | | |

### Sorting Operations

| Algorithm | Compatible with Collection? | Comment |
|----------------------|-----------------------------|---------|
| `std::is_sorted` | | |
| `std::is_sorted_until` | | |
| `std::sort` | | |
| `std::partial_sort` | | |
| `std::partial_sort_copy` | | |
| `std::stable_sort` | | |
| `std::nth_element` | | |

### Binary Search Operations (on Sorted Ranges)

| Algorithm | Compatible with Collection? | Comment |
|----------------------|-----------------------------|---------|
| `std::lower_bound` | | |
| `std::upper_bound` | | |
| `std::binary_search` | | |
| `std::equal_range` | | |

### Other Operations on Sorted Ranges

| Algorithm | Compatible with Collection? | Comment |
|----------------------|-----------------------------|---------|
| `std::merge` | | |
| `std::inplace_merge` | | |

### Set Operations (on Sorted Ranges)

| Algorithm | Compatible with Collection? | Comment |
|----------------------|-----------------------------|---------|
| `std::includes` | | |
| `std::set_difference` | | |
| `std::set_intersection` | | |
| `std::set_symmetric_difference` | | |
| `std::set_union` | | |

### Heap Operations

| Algorithm | Compatible with Collection? | Comment |
|----------------------|-----------------------------|---------|
| `std::is_heap` | | |
| `std::is_heap_until` | | |
| `std::make_heap` | | |
| `std::push_heap` | | |
| `std::pop_heap` | | |
| `std::sort_heap` | | |

### Minimum/Maximum Operations

| Algorithm | Compatible with Collection? | Comment |
|----------------------|-----------------------------|---------|
| `std::max` | | |
| `std::max_element` | | |
| `std::min` | | |
| `std::min_element` | | |
| `std::minmax` | | |
| `std::minmax_element` | | |
| `std::clamp` | | |


### Comparison operations

| Algorithm | Compatible with Collection? | Comment |
| ----------|-----------------------------|---------|
| `std::equal` | | |
| `std::lexicographical_compare` | | |
| `std::lexicographical_compare_three_way` | | |

### Permutation operations

| Algorithm | Compatible with Collection? | Comment |
| ----------|-----------------------------|---------|
| `std::is_permutation` | | |
| `std::next_permutation ` | | |
| `std::prev_permutation` | | |

## Standard ranges
Most of the standard algorithms require the iterators to be at least *InputIterator*. The iterators of PODIO collection don't fulfil this requirement, therefore they are not compatible with standard algorithms according to specification. In practice some algorithms may still compile with the collections depending on a implementation of a given algorithm.

## Standard range algorithms

The standard range algorithm use constrains to operate at least on `std::input_iterator`s and `std::ranges::input_range`s. The iterators of PODIO collection don't model these concepts, therefore can't be use with standard range algorithms.

0 comments on commit b597adf

Please sign in to comment.