Commit 563e23aa authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Fix unintended cast in TBB Reduce's return value

It was setting the return value type the same as the initial value.
However, the value type can change based on the array type and the
operator.
parent a7100c84
......@@ -145,7 +145,8 @@ public:
}
template <typename T, typename U, class CIn>
VTKM_CONT static U Reduce(const vtkm::cont::ArrayHandle<T, CIn>& input, U initialValue)
VTKM_CONT static auto Reduce(const vtkm::cont::ArrayHandle<T, CIn>& input, U initialValue)
-> decltype(Reduce(input, initialValue, vtkm::Add{}))
{
VTKM_LOG_SCOPE_FUNCTION(vtkm::cont::LogLevel::Perf);
......@@ -153,9 +154,10 @@ public:
}
template <typename T, typename U, class CIn, class BinaryFunctor>
VTKM_CONT static U Reduce(const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue,
BinaryFunctor binary_functor)
VTKM_CONT static auto Reduce(const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue,
BinaryFunctor binary_functor)
-> decltype(tbb::ReducePortals(input.ReadPortal(), initialValue, binary_functor))
{
VTKM_LOG_SCOPE_FUNCTION(vtkm::cont::LogLevel::Perf);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment