P3983R0 — Object Representation for std::simd
(6 items)
LWG, LEWG
The C++26 Working Draft makes std::simd types trivially copyable, enabling std::bit_cast, but leaves the object representation unspecified, preventing portable bit reinterpretation idioms widely used in SIMD programming. This paper proposes mandating an array-like object representation (contiguous, index-ordered, no padding) for basic_vec> specializations, reflecting universal hardware practice, and additionally providing is_simd_array_like_v and is_mask_array_like_v query traits so generic code can discover layout properties for other ABIs. The fixed_size ABI is explicitly excluded from the layout mandate due to divergent implementation strategies and is left for future work.
- Section 9.1 and Section 9.2 — is_simd_array_like_v and is_mask_array_like_v are inline constexpr bool variable templates, but their specifications use "Returns:" and "Remarks:", which per [structure.specifications] are function specification elements. Variable templates should use descriptive prose (e.g., "is true if and only if..."). [1]
-
Section 1 (Introduction) — basic_vec
misrepresents the template signature; the second parameter is an ABI tag type, not a numeric size. The paper itself uses basic_vec everywhere else. [1] [2] - Section 3.2 — A markdown link to [simd.overview](https://eel.is/c++draft/simd#overview) failed to render as a hyperlink, leaving the raw URL visible inline in parentheses. [2] [3]
References — Anthropic Citations API
[1]
chars 2197–2371
"Since basic_vec is conceptually similar to array (both are fixed-size containers of homogeneous elements), users naturally expect similar bit-casting guarantees. "
"Since basic_vec
[2]
"Returns: For is_simd_array_like_v: true if the object representation of basic_vec is identical to the object representation of array and Remarks: is_simd_array_like_v
"Returns: For is_simd_array_like_v
[3]
chars 8394–8645
"Recommended practice for conversions: The draft states "Implementations should support implicit conversions between specializations of basic_vec and appropriate implementation-defined types (see..."
"Recommended practice for conversions: The draft states "Implementations should support implicit conversions between specializations of basic_vec and appropriate implementation-defined types (see..."
Summary: P3983R0 proposes guaranteeing that std::simd (basic_vec) has an object representation identical to a std::array of the same element type and size, enabling reinterpret_cast, memcpy, and similar low-level operations between simd objects and arrays. It evaluates several approaches and recommends a combination of a normative array-like layout requirement and type traits to query that guarantee.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.