[PATCH v1] libcamera: base: span: Explicitly default copy assignment

Jacopo Mondi jacopo.mondi at ideasonboard.com
Mon Mar 17 19:33:58 CET 2025


Hi Barnabás

On Mon, Mar 10, 2025 at 06:03:56PM +0100, Barnabás Pőcze wrote:
> The `dynamic_extent` specialization is currently not trivially copyable
> unlike its standard counterpart, `std::span`. This is because the copy
> assignment operator is user-defined. Explicitly default it just like
> it is done in the main template definition.
>
> Signed-off-by: Barnabás Pőcze <barnabas.pocze at ideasonboard.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>

Thanks
  j

> ---
>  include/libcamera/base/span.h | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/include/libcamera/base/span.h b/include/libcamera/base/span.h
> index 92cce4f05..806db106e 100644
> --- a/include/libcamera/base/span.h
> +++ b/include/libcamera/base/span.h
> @@ -346,13 +346,7 @@ public:
>  	}
>
>  	constexpr Span(const Span &other) noexcept = default;
> -
> -	constexpr Span &operator=(const Span &other) noexcept
> -	{
> -		data_ = other.data_;
> -		size_ = other.size_;
> -		return *this;
> -	}
> +	constexpr Span &operator=(const Span &other) noexcept = default;
>
>  	constexpr iterator begin() const { return data(); }
>  	constexpr const_iterator cbegin() const { return begin(); }
> --
> 2.48.1
>


More information about the libcamera-devel mailing list