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

Stop using std::is_trivial #2039

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Stop using std::is_trivial #2039

wants to merge 6 commits into from

Conversation

akukanov
Copy link
Contributor

@akukanov akukanov commented Feb 3, 2025

Since std::is_trivial is deprecated in C++ 26, it makes sense to get rid of it in our code in advance. This is requested in the issue #1961.

In type_traits, we simply inject names into the oneDPL namespace, so the only change there so far is to add a comment.

In glue_memory_impl,h, is_trivial is checked to "optimize" the implementation for trivial types (it is worth checking if that really brings any performance improvement, but let's keep that for later). There we have a few cases:

  • In uninitialized_copy/move, the in-place construction is changed to the "copy" brick, which essentially does an assignment like *result = *input. Therefore, here the check is for the result value type to be trivially default-constructible and trivially assignable from the input reference type.
  • In uninitialized_value_construct, the "optimization" uses the "fill" brick which assigns a given value of the output value type. Therefore the new check is for trivially default-constructible and trivially copyable. The same logic applies to uninitialized_fill, which currently (before the patch) checks for std::is_arithmetic :)
  • In uninitialized_default_construct, construction is fully skipped - so the check should be for trivially default-constructible only.

Each of the described cases is fixed (and can be reviewed) in a separate commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant