Created on 2026-03-09.00:00:00 last changed 4 days ago
Proposed resolution:
This wording is relative to N5032.
Modify [meta.syn], header <meta> synopsis, as indicated:
#include <compare> // see [compare.syn] #include <initializer_list> // see [initializer.list.syn] namespace std { […] // [meta.define.static], promoting to static storage […] template<ranges::input_range R> consteval span<const ranges::range_value_t<R>, see below> define_static_array(R&& r); […] }
Modify [meta.define.static] as indicated:
template<ranges::input_range R> consteval span<const ranges::range_value_t<R>, see below> define_static_array(R&& r);-16- Effects: Equivalent to:
using T = ranges::range_value_t<R>; meta::info array = meta::reflect_constant_array(r); if (meta::is_array_type(meta::type_of(array))) { return span<const T, see below>(meta::extract<const T*>(array), meta::extent(meta::type_of(array))); } else { return span<const T, see below>(static_cast<const T*>(nullptr), 0); }-?- Remarks: The second template argument of the returned `span` type is
static_cast<size_t>(ranges::size(r))if `ranges::size(r)` is a constant expression, and `dynamic_extent` otherwise.
[ Croydon 2026-03-27; move to Immediate. ]
[ 2026-03-26; Tim reopens and provides revised wording ]
The `else` branch is ill-formed when the returned has non-zero static extent.
[ Croydon 2026-03-25; move to Immediate. ]
This wording is relative to N5032.
Modify [meta.syn], header <meta> synopsis, as indicated:
#include <compare> // see [compare.syn] #include <initializer_list> // see [initializer.list.syn] namespace std { […] // [meta.define.static], promoting to static storage […] template<ranges::input_range R> consteval span<const ranges::range_value_t<R>, see below> define_static_array(R&& r); […] }
Modify [meta.define.static] as indicated:
template<ranges::input_range R> consteval span<const ranges::range_value_t<R>, see below> define_static_array(R&& r);-16- Effects: Equivalent to:
using T = ranges::range_value_t<R>; meta::info array = meta::reflect_constant_array(r); if (meta::is_array_type(meta::type_of(array))) { return span<const T, see below>(meta::extract<const T*>(array), meta::extent(meta::type_of(array))); } else { return span<const T, see below>(); }-?- Remarks: The second template argument of the returned `span` type is
static_cast<size_t>(ranges::size(r))if `ranges::size(r)` is a constant expression, and `dynamic_extent` otherwise.
[ 2026-03-25; Reflector poll. ]
Set priority to 2 after reflector poll.
`define_static_array` can transform any input range, even a non-contiguous one, into a `span`.
However, the returned `span` always has a dynamic extent. If the size of the input range is known at compile time, returning a static `span` seems reasonable and may offer slight runtime efficiency.| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-03-27 11:35:15 | admin | set | messages: + msg16113 |
| 2026-03-27 11:35:15 | admin | set | status: open -> immediate |
| 2026-03-27 01:52:04 | admin | set | messages: + msg16103 |
| 2026-03-27 01:52:04 | admin | set | status: immediate -> open |
| 2026-03-25 13:29:12 | admin | set | messages: + msg16079 |
| 2026-03-25 13:29:12 | admin | set | status: new -> immediate |
| 2026-03-25 10:06:37 | admin | set | messages: + msg16070 |
| 2026-03-09 17:16:41 | admin | set | messages: + msg16017 |
| 2026-03-09 00:00:00 | admin | create | |