<xmemory>: Consider clarifying the static_assert for Container<const T>
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
We emit a static_assert when a user attempts to say vector<const T> and so forth. Somewhat confusingly, this is emitted at the std::allocator layer:
The Standard's wording is distressingly unclear; once upon a time, allocator was indeed the best way to see that Container<const T> was forbidden (because it would overload allocator::address() improperly). Now this appears to be indirectly specified through the allocator requirements.
Ideally, the Standard would be clarified to obviously forbid Container<const T>. Until then, we should consider clarifying this static_assert, and possibly move it into each container. (I hope users aren't saying map<const int, const int> and so forth.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the static_assert in stl/inc/xmemory at lines 737-741 and review the issue's linked context about Container. Determine whether the diagnostic should be clarified or moved into individual containers, and establish the intended behavior for cases such as map<const int, const int>.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100