[ADT] Introduce `map_to_vector` helper
The following pattern is common in the llvm codebase, as well as in downstream projects: ``` llvm::to_vector(llvm::map_range(container, lambda)) ``` This patch introduces a shortcut for this called `map_to_vector`. This template depends on both `llvm/ADT/SmallVector.h` and `llvm/ADT/STLExtras.h`, and since these are both relatively large and do not depend on each other, the `map_to_vector` helper is placed in a new header under `llvm/ADT/SmallVectorExtras.h`. Only a handful of use cases have been updated to use the new helper. Differential Revision: https://reviews.llvm.org/D145390
Loading
Please sign in to comment