Commit graph

10 commits

Author SHA1 Message Date
Andreas Kling ae3ffdd521 AK: Make it possible to not using AK classes into the global namespace
This patch adds the `USING_AK_GLOBALLY` macro which is enabled by
default, but can be overridden by build flags.

This is a step towards integrating Jakt and AK types.
2022-11-26 15:51:34 +01:00
Lenny Maiorani 49042bffe9 AK: Add nodiscard attribute to AnyOf functions 2022-07-04 05:53:56 +00:00
Lenny Maiorani 2e6fc13b1e AK: Implement any_of using common implementation
Problem:
- `any_of` is implemented in 2 different ways, one for the entire
  container and a different implementation for a partial container
  using iterators.

Solution:
- Follow the "don't repeat yourself" (DRY) idiom and implement the
  entire container version in terms of the partial version.
2021-08-06 23:57:48 +02:00
Ali Mohammad Pur 73fc2b3748 AK: Rewrite {AnyOf,AllOf,Find}.h to use the IteratorPairWith concept
This makes it so these algorithms are usable with arbitrary iterators,
as opposed to just instances of AK::SimpleIterator.
This commit also makes the requirement of ::index() in find_index()
explicit, as previously it was accepting any iterator.
2021-07-22 22:56:20 +02:00
Ali Mohammad Pur 2dc31c503e AK: Convert AnyOf/AllOf to east-const style 2021-07-22 22:56:20 +02:00
Ali Mohammad Pur d40d10aae7 AK: Implement {any,all}_of(IterableContainer&&, Predicate)
This is a generally nicer-to-use version of the existing {any,all}_of()
that doesn't require the user to explicitly provide two iterators.
As a bonus, it also allows arbitrary iterators (as opposed to the hard
requirement of providing SimpleIterators in the iterator version).
2021-07-22 22:56:20 +02:00
Lenny Maiorani 24225df979 AK: Reimplement any_of in terms of find_if
Problem:
- Now that a generic free-function form of `find_if` is implemented
  the code in `any_of` is redundant.

Solution:
- Follow the "don't repeat yourself" mantra and make the code DRY by
  implementing `any_of` in terms of `find_if`.
2021-06-20 10:54:09 +01:00
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling 7c6de80e81 AK: Publish AK::any_of by default 2021-02-07 11:35:08 +01:00
Lenny Maiorani d11727ff28 AK: Implement generic any_of algorithm
Problem:
- Raw loops are often written to validate that any values in a
  container meet a predicate, but raw loops are not as expressive as
  functions implementing well-named algorithms and are error-prone.

Solution:
- Implement a very generic form of `any_of`.
2021-01-15 09:42:42 +01:00