-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
The examples of count and any_of implemented using reduce aren't correct: https://github.com/codereport/Algorithms/blob/master/stl_14_reduce_accumulate.cpp. Because reduce can be applied out of order, you have to have associative, commutative functions. The functions being passed here don't even expect the same type for their left and right argument, so they're clearly not commutative. They could be changed to use accumulate, although in the case of any_of you're still better off using find_if.
Metadata
Metadata
Assignees
Labels
No labels