This mirrors the interface of StringRef by adding functions for searching and dropping items from an ArrayRef until a certain condition is met. Specifically, this adds take_front, take_back, drop_front, and drop_back, along with helper functions find_if and find_if_not.
Details
Details
Diff Detail
Diff Detail
Event Timeline
include/llvm/ADT/ArrayRef.h | ||
---|---|---|
172 | joker-eph pointed me to llvm::find_if(), I think I will add llvm::find_if_not(), then have the functions use that, and that should address both of your comments at the same time. |
Comment Actions
- Deleted member find_if and find_if_not
- Deleted npos
- Convert take / drop functions to use llvm::find_if and llvm::find_if_not free functions.
- Updated the aforementioned functions to take a templatized predicate instead of an llvm::function_ref.
Comment Actions
I would suggest passing the predicate by value instead of const reference to match the standard library. Feel free to fix up the range adapters in a separate patch and systematically.
Also, I'd suggest 'typename PredicateT' and 'PredicateT P' for naming conventions, if you want to be fully nit-picky. =D
I'm really reluctant to add APIs based around the 'npos' idea. How challenging does removing this and relying exclusively on iterator based constructs make things?