Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rongou authored and alliepiper committed Aug 28, 2020
1 parent fc12fa5 commit ec5baea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions thrust/system/cuda/detail/transform_scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ transform_inclusive_scan(execution_policy<Derived> &policy,
TransformOp transform_op,
ScanOp scan_op)
{
// Use the input iterator's value type per https://wg21.link/P0571
using input_type = typename thrust::iterator_value<InputIt>::type;
#if THRUST_CPP_DIALECT < 2017
using result_type = typename std::result_of<TransformOp(input_type)>::type;
#else
using result_type = std::invoke_result_t<TransformOp, input_type>;
#endif

typedef typename iterator_traits<InputIt>::difference_type size_type;
size_type num_items = static_cast<size_type>(thrust::distance(first, last));
Expand Down
5 changes: 5 additions & 0 deletions thrust/system/detail/generic/transform_scan.inl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ __host__ __device__
UnaryFunction unary_op,
BinaryFunction binary_op)
{
// Use the input iterator's value type per https://wg21.link/P0571
using InputType = typename thrust::iterator_value<InputIterator>::type;
#if THRUST_CPP_DIALECT < 2017
using ValueType = typename std::result_of<UnaryFunction(InputType)>::type;
#else
using ValueType = std::invoke_result_t<UnaryFunction, InputType>;
#endif

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

0 comments on commit ec5baea

Please sign in to comment.