Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Make packed_pixel trivially copyable and assignable #679

Merged
merged 1 commit into from
May 28, 2022

Conversation

marco-langer
Copy link
Contributor

@marco-langer marco-langer commented May 28, 2022

Description

Following the Rule of Zero, this PR removes the user-defined copy constructor and copy assignment operator from packed_pixel. The type is now trivially copyable and trivially assignable:

#include <boost/gil.hpp>
#include <boost/mp11.hpp>
#include <type_traits>

namespace gil = boost::gil;
namespace mp11 = boost::mp11;

int main()
{
  using packed_channel_references_3 = typename gil::detail::packed_channel_references_vector_type
  <
      std::uint8_t,
      mp11::mp_list_c<int, 3>
  >::type;

  using packed_pixel_gray3 = gil::packed_pixel
  <
      std::uint8_t,
      packed_channel_references_3,
      gil::gray_layout_t
  >;

  static_assert(std::is_trivially_copyable<packed_pixel_gray3>::value);
  static_assert(std::is_trivially_assignable<packed_pixel_gray3, packed_pixel_gray3>::value);

  return 0;
}

Tasklist

  • Ensure all CI builds pass
  • Review and approve

Copy link
Member

@mloskot mloskot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@mloskot mloskot added cat/enhancement Improvements, but not fixes addressing identified bugs core boost/gil labels May 28, 2022
@mloskot mloskot added this to the Boost 1.80 milestone May 28, 2022
@mloskot mloskot changed the title make packed_pixel trivially copyable and assignable refactor: Make packed_pixel trivially copyable and assignable May 28, 2022
@mloskot mloskot merged commit 98f4971 into boostorg:develop May 28, 2022
@mloskot mloskot mentioned this pull request Jul 5, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat/enhancement Improvements, but not fixes addressing identified bugs core boost/gil
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants