Skip to content

Commit

Permalink
Fix implicitly-declared copy constructor is deprecated in planar_pixe…
Browse files Browse the repository at this point in the history
…l_reference.hpp

Add TODO comment on: What is the purpose of returning via const reference?
  • Loading branch information
mloskot committed Jul 22, 2019
1 parent f027895 commit f2d0958
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions include/boost/gil/planar_pixel_reference.hpp
Expand Up @@ -82,12 +82,30 @@ struct planar_pixel_reference : detail::homogeneous_color_base
: parent_t(v0, v1, v2, v3, v4, v5)
{}

planar_pixel_reference(planar_pixel_reference const& p) : parent_t(p) {}

// TODO: What is the purpose of returning via const reference?
auto operator=(planar_pixel_reference const& p) const -> planar_pixel_reference const&
{
static_copy(p, *this);
return *this;
}

template <typename Pixel>
planar_pixel_reference(Pixel const& p) : parent_t(p)
{
check_compatible<Pixel>();
}

// TODO: What is the purpose of returning via const reference?
template <typename Pixel>
auto operator=(Pixel const& p) const -> planar_pixel_reference const&
{
check_compatible<Pixel>();
static_copy(p, *this);
return *this;
}

// PERFORMANCE_CHECK: Is this constructor necessary?
template <typename ChannelV, typename Mapping>
planar_pixel_reference(pixel<ChannelV, layout<ColorSpace, Mapping>>& p)
Expand All @@ -102,20 +120,6 @@ struct planar_pixel_reference : detail::homogeneous_color_base
: parent_t(p, diff)
{}

auto operator=(planar_pixel_reference const& p) const -> planar_pixel_reference const&
{
static_copy(p, *this);
return *this;
}

template <typename Pixel>
auto operator=(Pixel const& p) const -> planar_pixel_reference const&
{
check_compatible<Pixel>();
static_copy(p, *this);
return *this;
}

// This overload is necessary for a compiler implementing Core Issue 574
// to prevent generation of an implicit copy assignment operator (the reason
// for generating implicit copy assignment operator is that according to
Expand Down

0 comments on commit f2d0958

Please sign in to comment.