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 std::find to detect if an element exists +/// in a container. +template +bool is_contained(R && Range, const E &Element) { + return std::find(Range.begin(), Range.end(), Element) != Range.end(); +} + //===----------------------------------------------------------------------===// // Extra additions to //===----------------------------------------------------------------------===//