summaryrefslogtreecommitdiff
path: root/subprojects/libyuv.wrap
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-04-23 02:01:51 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-05-18 14:45:28 +0300
commitad38d9151b87ccd7628d09e0a9668539117a4f8b (patch)
treeca2d9aaa28d14fd7215fcd58b121051c69e129be /subprojects/libyuv.wrap
parentd832e9622e69f88986c2b5a3ea836238b860e0f7 (diff)
libcamera: utils: Add enumerate view for range-based for loops
Range-based for loops are handy and widely preferred in C++, but are limited in their ability to replace for loops that require access to a loop counter. The enumerate() function solves this problem by wrapping the iterable in an adapter that, when used as a range-expression, will provide iterators whose value_type is a pair of index and value reference. The iterable must support std::begin() and std::end(). This includes all containers provided by the standard C++ library, as well as C-style arrays. A typical usage pattern would use structured binding to store the index and value in two separate variables: std::vector<int> values = ...; for (auto [index, value] : utils::enumerate(values)) { ... } Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'subprojects/libyuv.wrap')
0 files changed, 0 insertions, 0 deletions