From 36c15f32c95552107903604db4b3e63752e49378 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 27 Dec 2020 11:20:59 +0200 Subject: libcamera: utils: Add reverse adapter for range-based loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a utils::reverse() function that creates an adapter wrapping in iterable, such that range-based iteration over the adapter iterates over the iterable in reverse order. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/libcamera/utils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/libcamera/utils.cpp') diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp index e90375ae..c4098a74 100644 --- a/src/libcamera/utils.cpp +++ b/src/libcamera/utils.cpp @@ -464,6 +464,14 @@ std::string libcameraSourcePath() * \return The value rounded up to the nearest multiple of \a alignment */ +/** + * \fn reverse(T &&iterable) + * \brief Wrap an iterable to reverse iteration in a range-based loop + * \param[in] iterable The iterable + * \return A value of unspecified type that, when used in a range-based for + * loop, will cause the loop to iterate over the \a iterable in reverse order + */ + } /* namespace utils */ } /* namespace libcamera */ -- cgit v1.2.1