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

Make STL components not dependent on is_trivial(_v) #5202

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Dec 23, 2024

Towards #5137/WG21-P3247R2. IMO most related changes should be done for older modes. libstdc++ is already doing so.

Product code

  • On type requirements of basic_string: There requirements seem to be slightly strengthened, but I don't believe a "character-like type" with a private default constructor can ever be supported.
    • For basic_string_view, it seems that "character-like type" with a private default constructor can be supported. I'm not sure whether it should be changed.
  • On _Can_memcpy_val: Trivial default-constructibility is not actually requried, so I just relax the condition to is_trivially_copyable_v.
  • On _Uninitialized_copy_multidimensional(_al): Like above, but the dispatching condition should be more precise.
  • On internal hashing functions and _Circular_buffer: static_assert doesn't seem necessary as the involved types are either scalar or implementation-controlled, but the checks seem desired to avoid regression.
  • On _Unaligned_load: The function template is used and instantiated only once, so I think it's better to inline it into the caller.

Test code

  • Given "is_trivially_copyable_v & is_trivially_default_constructible_v" is slight stronger than "is_trivial_v", I decide to use the former style thoroughly except when is_trivial(_v) themselves are tested.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner December 23, 2024 04:04
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jan 4, 2025
@StephanTLavavej StephanTLavavej self-assigned this Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
Status: Initial Review
Development

Successfully merging this pull request may close these issues.

2 participants