Skip to content

Commit ec5baea

Browse files
rongoualliepiper
authored andcommitted
review feedback
1 parent fc12fa5 commit ec5baea

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

thrust/system/cuda/detail/transform_scan.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ transform_inclusive_scan(execution_policy<Derived> &policy,
5050
TransformOp transform_op,
5151
ScanOp scan_op)
5252
{
53+
// Use the input iterator's value type per https://wg21.link/P0571
5354
using input_type = typename thrust::iterator_value<InputIt>::type;
55+
#if THRUST_CPP_DIALECT < 2017
5456
using result_type = typename std::result_of<TransformOp(input_type)>::type;
57+
#else
58+
using result_type = std::invoke_result_t<TransformOp, input_type>;
59+
#endif
5560

5661
typedef typename iterator_traits<InputIt>::difference_type size_type;
5762
size_type num_items = static_cast<size_type>(thrust::distance(first, last));

thrust/system/detail/generic/transform_scan.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,13 @@ __host__ __device__
4848
UnaryFunction unary_op,
4949
BinaryFunction binary_op)
5050
{
51+
// Use the input iterator's value type per https://wg21.link/P0571
5152
using InputType = typename thrust::iterator_value<InputIterator>::type;
53+
#if THRUST_CPP_DIALECT < 2017
5254
using ValueType = typename std::result_of<UnaryFunction(InputType)>::type;
55+
#else
56+
using ValueType = std::invoke_result_t<UnaryFunction, InputType>;
57+
#endif
5358

5459
thrust::transform_iterator<UnaryFunction, InputIterator, ValueType> _first(first, unary_op);
5560
thrust::transform_iterator<UnaryFunction, InputIterator, ValueType> _last(last, unary_op);

0 commit comments

Comments
 (0)