This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
simd::basic_vec
CTAD misses difference type castingSection: 29.10.7.2 [simd.ctor] Status: New Submitter: Hewill Kang Opened: 2025-10-04 Last modified: 2025-10-04
Priority: Not Prioritized
View other active issues in [simd.ctor].
View all other issues in [simd.ctor].
View all issues with New status.
Discussion:
Currently, basic_vec
can take an object r
of range type R
whose size is a
constant expression and deduced to vec<ranges::range_value_t<R>, ranges::size(r)>
.
R
has a an integer-class type size which cannot
be implicitly converted to simd-size-type
, which is a signed integer type.
It is necessary to perform difference type casting here, and the narrowing
conversion will still correctly be rejected due to the constructor's constraints.
Proposed resolution:
This wording is relative to N5014.
Modify 29.10.7.2 [simd.ctor] as indicated:
template<class R, class... Ts> basic_vec(R&& r, Ts...) -> see below;-17- Constraints:
(17.1) —
R
modelsranges::contiguous_range
andranges::sized_range
, and(17.2) —
ranges::size(r)
is a constant expression.-18- Remarks: The deduced type is equivalent to
vec<ranges::range_value_t<R>, static_cast<simd-size-type>(ranges::size(r))>