highway icon indicating copy to clipboard operation
highway copied to clipboard

Resolve TODO in aligned_allocator

Open scuzqy opened this issue 1 year ago • 1 comments

And updated corresponding test. AllocateAligned was designed to take POD types only.

I also removed TestAllocateAlignedObjectWithoutDestructor because objects with constructor/destructor are obviously illegal input. btw, restriction here can be one is_trivial, perhaps?

scuzqy avatar Aug 09 '24 17:08 scuzqy

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Aug 09 '24 17:08 google-cla[bot]

Will this be merged?

scuzqy avatar Jan 20 '25 16:01 scuzqy

Thanks for following up. I see that our internal CI had failed and blocked the merge. Investigating..

jan-wassenberg avatar Jan 20 '25 16:01 jan-wassenberg

Mind if we change the check to:

  static_assert(std::is_trivially_copyable<T>::value,
                "AllocateAligned: requires trivially copyable T");
  static_assert(std::is_trivially_destructible<T>::value,
                "AllocateAligned: requires trivially destructible T");

? We have internal users that trip over the standard layout and trivial requirements.

jan-wassenberg avatar Jan 20 '25 16:01 jan-wassenberg

Mind if we change the check to:

  static_assert(std::is_trivially_copyable<T>::value,
                "AllocateAligned: requires trivially copyable T");
  static_assert(std::is_trivially_destructible<T>::value,
                "AllocateAligned: requires trivially destructible T");

? We have internal users that trip over the standard layout and trivial requirements.

Sure. In fact is_trivial_xxx is better

Thanks for checking!

scuzqy avatar Jan 20 '25 17:01 scuzqy

Merged with the proposed modification. Thanks again!

jan-wassenberg avatar Jan 21 '25 11:01 jan-wassenberg