Skip to content

🎨 Let intrusive_list be instantiated with incomplete types #241

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

Merged
merged 1 commit into from
Jul 1, 2025

Conversation

elbeno
Copy link
Contributor

@elbeno elbeno commented Jul 1, 2025

Problem:

  • intrusive_list and forward_intrusive_list cannot be instantiated with incomplete types in C++20, because the constraints do not allow it. Since these lists use pointers, it's often useful to declare them using incomplete types. Assuming that the types are complete before actually using the list, this should be fine.

Solution:

  • Add complete concept and is_complete_v variable template.
  • Allow use of incomplete types to instantiate intrusive_list and intrusive_forward_list.

Problem:
- `intrusive_list` and `forward_intrusive_list` cannot be instantiated with
  incomplete types in C++20, because the constraints do not allow it. Since
  these lists use pointers, it's often useful to declare them using incomplete
  types. Assuming that the types are complete before actually using the list,
  this should be fine.

Solution:
- Add `complete` concept and `is_complete_v` variable template.
- Allow use of incomplete types to instantiate `intrusive_list` and
  `intrusive_forward_list`.
@elbeno elbeno merged commit e5131a0 into intel:main Jul 1, 2025
42 checks passed
@elbeno elbeno deleted the incomplete-intrusive branch July 1, 2025 17:30
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.

2 participants