libcamera/test
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
..
camera meson: Fix coding style when declaring arrays 2021-02-11 18:20:22 +02:00
controls test: control_list: Test ControlList::merge() 2021-05-06 15:08:34 +02:00
ipa ipa: Add sensor model string to IPASettings 2021-03-23 18:43:58 +02:00
ipc tests: Add test for IPCPipeUnixSocket 2021-03-02 19:27:31 +09:00
libtest libcamera: v4l2_device: Return a unique pointer from fromEntityName() 2020-12-09 11:26:25 +02:00
log libcamera: Move EventDispatcher to internal API 2020-11-15 22:21:28 +02:00
media_device libcamera: Drop unneeded empty default constructors and destructors 2020-10-23 22:48:17 +03:00
pipeline libcamera: camera: Rename name() to id() 2020-08-05 20:07:13 +02:00
process meson: Fix coding style when declaring arrays 2021-02-11 18:20:22 +02:00
serialization tests: Test IPA serializer generation 2021-03-02 19:27:35 +09:00
stream meson: Fix coding style when declaring arrays 2021-02-11 18:20:22 +02:00
v4l2_compat tests: v4l2_compat: Fix v4l2-compliance and v4l2-ctl version parsing 2020-07-17 18:50:10 +09:00
v4l2_subdevice meson: Fix coding style when declaring arrays 2021-02-11 18:20:22 +02:00
v4l2_videodevice meson: Fix coding style when declaring arrays 2021-02-11 18:20:22 +02:00
bayer-format.cpp test: bayer-format: Rectify internal header's #include path 2021-05-05 10:32:33 +02:00
byte-stream-buffer.cpp libcamera: Move internal headers to include/libcamera/internal/ 2020-05-16 03:38:11 +03:00
camera-sensor.cpp libcamera: Move internal headers to include/libcamera/internal/ 2020-05-16 03:38:11 +03:00
delayed_controls.cpp test: delayed_controls: Rename delayed_contols.cpp to delayed_controls.cpp 2021-03-12 14:20:51 +00:00
event-dispatcher.cpp libcamera: Move EventDispatcher to internal API 2020-11-15 22:21:28 +02:00
event-thread.cpp libcamera: Move EventDispatcher to internal API 2020-11-15 22:21:28 +02:00
event.cpp libcamera: Move EventDispatcher to internal API 2020-11-15 22:21:28 +02:00
file-descriptor.cpp test: file-descriptor: Add "fd move" constructor test 2020-05-19 18:08:11 +03:00
file.cpp test: file: Check that directories are not treated as files 2020-12-30 13:03:54 +00:00
geometry.cpp test: geometry: Add unit tests for new geometry helper functions 2020-10-27 14:06:51 +02:00
hotplug-cameras.cpp libcamera: Move EventDispatcher to internal API 2020-11-15 22:21:28 +02:00
mapped-buffer.cpp test: Omit extra semicolons 2020-10-20 13:15:43 +03:00
meson.build meson: Summarize which applications and adaptation layers are built 2021-03-28 01:47:26 +02:00
message.cpp libcamera: Move internal headers to include/libcamera/internal/ 2020-05-16 03:38:11 +03:00
object-delete.cpp tests: Add a test case for the Object::deleteLater() API, to verify 2020-07-31 23:33:35 +03:00
object-invoke.cpp libcamera: Move EventDispatcher to internal API 2020-11-15 22:21:28 +02:00
object.cpp libcamera: Move internal headers to include/libcamera/internal/ 2020-05-16 03:38:11 +03:00
pixel-format.cpp libcamera: pixel_format: Replace hex with format names 2020-06-25 06:47:48 +03:00
signal-threads.cpp libcamera: Move internal headers to include/libcamera/internal/ 2020-05-16 03:38:11 +03:00
signal.cpp test: signal: Add additional disconnection tests for Object 2020-01-22 17:26:20 +02:00
span.cpp test: span: Add tests for begin() and rbegin() 2021-04-15 22:23:02 +03:00
threads.cpp test: threads: Fix memory leak 2021-04-12 22:16:56 +03:00
timer-thread.cpp libcamera: Move EventDispatcher to internal API 2020-11-15 22:21:28 +02:00
timer.cpp libcamera: Move EventDispatcher to internal API 2020-11-15 22:21:28 +02:00
utils.cpp libcamera: utils: Add enumerate view for range-based for loops 2021-05-18 14:45:28 +03:00