summaryrefslogtreecommitdiff
path: root/include/libcamera/span.h
AgeCommit message (Collapse)Author
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>