ΒΆtemplate <typename R>
detail::enumerator<R> enumerate(R&& TheRange)
template <typename R>
detail::enumerator<R> enumerate(R&& TheRange)
Description
Given an input range, returns a new range whose values are are pair (A,B) such that A is the 0-based index of the item in the sequence, and B is the value from the original sequence. Example: std::vector <char > Items = {'A', 'B', 'C', 'D'}; for (auto X : enumerate(Items)) { printf("Item %d - %c\n", X.index(), X.value()); } Output: Item 0 - A Item 1 - B Item 2 - C Item 3 - D
Declared at: llvm/include/llvm/ADT/STLExtras.h:1511
Templates
- R
Parameters
- R&& TheRange