Skip to content

🎨 Let intrusive_list be instantiated with incomplete types#241

Merged
elbeno merged 1 commit intointel:mainfrom
elbeno:incomplete-intrusive
Jul 1, 2025
Merged

🎨 Let intrusive_list be instantiated with incomplete types#241
elbeno merged 1 commit intointel:mainfrom
elbeno:incomplete-intrusive

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