Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

sequence() should not convert the index to T #1498

@bjude

Description

@bjude

thrust::sequence currently uses the following struct to compute the sequence value (found in thrust/system/detail/generic/sequence.inl)

template <typename T>
struct compute_sequence_value
{
  T init;
  T step;

  __thrust_exec_check_disable__
  __host__ __device__
  T operator()(std::size_t i) const
  {
    return init + step * static_cast<T>(i);
  }
};
}

the static_cast<T>(i) will cause the algorithm to fail to compile in cases where step * i would otherwise work just fine (in my case T is float3)

Is this an intended limitation of sequence()? It would make more sense to me to use step * i if that was valid, falling back to trying the static_cast only if that would fail.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions