mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-25 01:25:08 +03:00
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> |
||
---|---|---|
.. | ||
camera | ||
controls | ||
ipa | ||
ipc | ||
libtest | ||
log | ||
media_device | ||
pipeline | ||
process | ||
serialization | ||
stream | ||
v4l2_compat | ||
v4l2_subdevice | ||
v4l2_videodevice | ||
bayer-format.cpp | ||
byte-stream-buffer.cpp | ||
camera-sensor.cpp | ||
delayed_controls.cpp | ||
event-dispatcher.cpp | ||
event-thread.cpp | ||
event.cpp | ||
file-descriptor.cpp | ||
file.cpp | ||
geometry.cpp | ||
hotplug-cameras.cpp | ||
mapped-buffer.cpp | ||
meson.build | ||
message.cpp | ||
object-delete.cpp | ||
object-invoke.cpp | ||
object.cpp | ||
pixel-format.cpp | ||
signal-threads.cpp | ||
signal.cpp | ||
span.cpp | ||
threads.cpp | ||
timer-thread.cpp | ||
timer.cpp | ||
utils.cpp |