Index: include/llvm/ADT/STLExtras.h =================================================================== --- include/llvm/ADT/STLExtras.h +++ include/llvm/ADT/STLExtras.h @@ -386,6 +386,13 @@ return std::find(Range.begin(), Range.end(), val); } +/// Wrapper function around llvm::any_of to detect if an element exists +/// in a container. +template +bool is_contained(R &&Range, const E &Element) { + return any_of(Range, bind2nd(std::equal_to(), Element)); +} + //===----------------------------------------------------------------------===// // Extra additions to //===----------------------------------------------------------------------===//