@@ -164,10 +164,22 @@ constexpr auto isSpan(T<TType, TExtent>) {
164164
165165template <typename TNew, typename TOld, std::size_t TExtent>
166166constexpr auto convertDataType (std::span<TOld, TExtent>& range) {
167+ if constexpr (TExtent == std::dynamic_extent) {
168+ return std::span<TNew>(
169+ reinterpret_cast <TNew*>(range.data ()), range.size () * sizeof (TOld) / sizeof (TNew)
170+ );
171+ }
167172 return std::span<TNew, TExtent * sizeof (TOld) / sizeof (TNew)>(
168173 reinterpret_cast <TNew*>(range.data ()), range.size ());
169174}
170175
176+ template <typename TNew, typename TOld>
177+ constexpr auto convertDataType2 (std::span<TOld>& range) {
178+ return std::span<TNew>(
179+ reinterpret_cast <TNew*>(range.data ()), range.size () * sizeof (TOld) / sizeof (TNew)
180+ );
181+ }
182+
171183struct IotaReductionChecker {
172184 uint32_t currentValue{};
173185
@@ -179,9 +191,7 @@ struct IotaReductionChecker {
179191 if (range.data () == nullptr ) {
180192 return std::make_tuple (Actions::CHECK, Payload (std::make_pair (false , Reason::nullpointer)));
181193 }
182- auto uintRange = convertDataType<uint32_t >(range);
183-
184- // TODO: Segmentation fault by std::iota
194+ auto uintRange = convertDataType2<uint32_t >(range);
185195 std::iota (std::begin (uintRange), std::end (uintRange), currentValue);
186196 size_t n = uintRange.size ();
187197
0 commit comments