libcamera/src
Laurent Pinchart ad38d9151b 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>
2021-05-18 14:45:28 +03:00
..
android android: jpeg: post_processor: Use the new metadata functions 2021-05-14 17:59:18 +09:00
cam cam: Implement OptMetadata 2021-05-06 15:09:42 +02:00
gstreamer meson: Summarize which applications and adaptation layers are built 2021-03-28 01:47:26 +02:00
ipa meson: Replace obselete join_paths() with '/' operator 2021-05-11 11:50:45 +01:00
lc-compliance lc-compliance: simple_capture: Handle unsupported roles 2021-04-21 20:05:21 +02:00
libcamera libcamera: utils: Add enumerate view for range-based for loops 2021-05-18 14:45:28 +03:00
qcam meson: Summarize which applications and adaptation layers are built 2021-03-28 01:47:26 +02:00
v4l2 meson: Summarize which applications and adaptation layers are built 2021-03-28 01:47:26 +02:00
meson.build src: meson: Define system paths 2021-04-30 11:53:09 +01:00