summaryrefslogtreecommitdiff
path: root/AK/AllOf.h
AgeCommit message (Collapse)Author
2021-07-24AK: Reimplement all_of in terms of find_ifLenny Maiorani
Problem: - Now that a generic free-function form of `find_if` is implemented the code in `all_of` is redundant. Solution: - Follow the "don't repeat yourself" mantra and make the code DRY by implementing `all_of` in terms of `find_if`. - One tricky part is that since captures are not permitted in `constexpr` lambdas, the lambda created to negate the predicate needs to be created by a function which does not capture and takes the predicate at run-time instead. This allows `all_of` to continue to work in a `constexpr` context.
2021-07-22AK: Rewrite {AnyOf,AllOf,Find}.h to use the IteratorPairWith conceptAli Mohammad Pur
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-22AK: Convert AnyOf/AllOf to east-const styleAli Mohammad Pur
2021-07-22AK: Implement {any,all}_of(IterableContainer&&, Predicate)Ali Mohammad Pur
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-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
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-02-17AK: Publish all_of()Andreas Kling
2020-12-20AllOf: Common iterator typesLenny Maiorani
Problem: - Interface is too permissive. It permits iterators of different types as long as they are comparable. Solution: - Require iterators be the same type.
2020-11-21AK: Implement generic all_of algorithmLenny Maiorani
Problem: - Raw loops are often written to validate that all 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 `all_of`.