Created on 2025-10-01.00:00:00 last changed 1 month ago
Proposed resolution:
This wording is relative to N5014.
Modify [sequence.reqmts] as indicated:
a.assign_range(rg)-60- Result:
-61- Mandates:voidassignable_from<T&, ranges::range_reference_t<R>>is modeled. For `inplace_vector`, if `ranges::size(rg)` is a constant expression then `ranges::size(rg)` ≤ `a.max_size()`.
Modify [inplace.vector.cons] as indicated:
template<container-compatible-range<T> R> constexpr inplace_vector(from_range_t, R&& rg);-?- Mandates: If `ranges::size(rg)` is a constant expression then `ranges::size(rg)` ≤ `N`.
-9- Effects: Constructs an `inplace_vector` with the elements of the range `rg`. -10- Complexity: Linear in `ranges::distance(rg)`.
[ Kona 2025-11-08; Status changed: Immediate → WP. ]
[ Kona 2025-11-06; approved by LWG. Status changed: New → Immediate. ]
[ 2025-10-22; Reflector poll. Status changed: New → LEWG and P3. ]
General support for change, after LEWG approval.
Suggestion was made that this could be extended to all containers, but is unlikely to be triggred in real word, as it requires ranges with static size greater than `size_t(-1)`.
Consider:
std::array<int, 42> a; std::inplace_vector<int, 5> v(std::from_range, a);
The above throws `std::bad_alloc` at runtime because the size of `array` is larger than capacity of `inplace_vector`. However, we should reject it at compile time since the `array` size is a constant expression.
Given that we do a lot of compile-time size checking in<simd>,
it's worth applying that here as well. Compile-time errors are better than runtime ones.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-11-11 10:48:55 | admin | set | messages: + msg15679 |
| 2025-11-11 10:48:55 | admin | set | status: immediate -> wp |
| 2025-11-06 02:49:41 | admin | set | messages: + msg15546 |
| 2025-11-06 02:49:41 | admin | set | status: lewg -> immediate |
| 2025-10-22 17:48:02 | admin | set | messages: + msg15356 |
| 2025-10-22 17:48:02 | admin | set | status: new -> lewg |
| 2025-10-04 10:32:40 | admin | set | messages: + msg15110 |
| 2025-10-01 00:00:00 | admin | create | |