Skip to content

Missing range adaptors in std::ranges #86

Description

@bigerl

It would be handy to have some range adaptors that are missing in std::ranges in here as well. Please add more as you like:

  • all_of, none_of, any_of that accept the range to be piped in
  • remove_element that accepts one argument and removes equality matches. Optionally with an additional binary predicate that is used instead of equality
  • all_equal Again, optionally with binary predicate
  • iota but with the interface of range() in python, e.g.:
    • range<size_t>(5): 0...4
    • range<size_t>(1,5): 1...4
    • range<size_t>(5,1): empty
    • range<size_t>(5,1,-1): 4...1
  • empty (and non_empty) that falls back to std::ranges::begin(range) == std::ranges::end(range) if std::ranges::empty is not supported
  • unique deduplicates elements.
    • This has probably some assumptions like elements being copyable without side effects.
    • having an equality operator
    • having a hash or being orderable
    • optionally, equality, less and hash function could be provided
  • all_distinct checks if all elements are distinct, again optional binary predicate to replace equality operator
  • join for std::format as provided in https://fmt.dev/latest/api/#range-and-tuple-formatting

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions