summaryrefslogtreecommitdiff
path: root/include/libcamera/span.h
AgeCommit message (Collapse)Author
2021-04-15libcamera: span: Fix reverse iteratorsLaurent Pinchart
std::reverse_iterator<iterator> is constructed from an instance of iterator, and automatically subtracts 1 when dereferencing. rbegin() and rend() should thus be constructed from end() and begin() respectively. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-01-31Revert "libcamera: Use helper variable template for type traits"Jean-Michel Hautbois
Some applications may not be compliant with C++17 (Chromium, as an example). Keep the C++17 features for libcamera internals, and C++14 compliance for public API. This reverts commit 6cbdc2859963e17bc897a4022f1d68170477d888. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-01-31Revert "libcamera: span: Provide and use helper variable templates for type ↵Jean-Michel Hautbois
traits" Some applications may not be compliant with C++17 (Chromium, as an example). Keep the C++17 features for libcamera internals, and C++14 compliance for public API. This reverts commit 8e42c2feb7ff7c350ffbbf97dd963dfd54e21faa. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-28libcamera: span: Provide and use helper variable templates for type traitsLaurent Pinchart
Following the C++17 practice, provide is_array_v<T> and is_span_v<T> helper variable templates as shorter versions of is_array<T>::value and is_span<T>::value, and use them through the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-28libcamera: Use helper variable template for type traitsLaurent Pinchart
C++17 introduces helper variable templates for type traits, allowing shortening std::is_foo<T>::value to std::is_foo_v<T>. Use them through the code base. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-26libcamera: span: Make constructors explicit as required by C++20Laurent Pinchart
The C++20 std::span class, after which Span is modelled, specifies four constructors as explicit when extent is not dynamic_extent. Align our implementation with those requirements. A careful reviewer may notice that this change addresses five constructors, not four. The reason is that the two constructors taking Container and const Container parameters are not specified in C++20, which uses a single constructor taking a range parameter instead. As ranges are not available in C++17, the Container constructors are our best effort at providing a similar feature. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-20include: libcamera: Omit extra semicolonsHirokazu Honda
This removes the unnecessary semicolon in span.h. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-30libcamera: span: Use default copy assignemnt operatorLaurent Pinchart
The custom implementation of the copy assignment operator is identical to the one the compiler would generate. Replace it by the default. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-08-25meson: Remove -Wno-unused-parameterLaurent Pinchart
We build libcamera with -Wno-unused-parameter and this doesn't cause much issue internally. However, it prevents catching unused parameters in inline functions defined in public headers. This can lead to compilation warnings for applications compiled without -Wno-unused-parameter. To catch those issues, remove -Wno-unused-parameter and fix all the related warnings with [[maybe_unused]]. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-06libcamera: Add a C++20-compliant std::span<> implementationJacopo Mondi
C++20 will contain a std::span<> class that provides view over a contiguous sequence of objects, the storage of which is owned by some other object. Add a compatible implementation to the utils namespace. This will be used to implement array controls. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>