Open AntonReinhard opened 2 years ago
@bernhardmgruber Can you please review it.
If the whole point of this iterator is to just return the same value whenever dereferences, I see no need to store an index. Then all iterator functions that move the iterator become noops. When do you need the index of the iterator?
You can probably make all member functions of
ConstantIterator
constexpr
andnoexcept
.
The index is required for begin and end pointer:
ConstantIterator c_begin(10);
ConstantIterator c_end = c_begin + 4;
for(; c_begin < c_end; ++c_begin){
std::cout << *c_begin << " "; // 10 10 10 10
}
Do you have a better idea?
The index is required for begin and end pointer:
ConstantIterator c_begin(10); ConstantIterator c_end = c_begin + 4; for(; c_begin < c_end; ++c_begin){ std::cout << *c_begin << " "; // 10 10 10 10 }
No, makes perfect sense now :D Without the index you would have an infinite range.
@AntonReinhard Can you please rebase to the current master. I removed the C++ 14 support. New default is C++ 17.
Ah, I knew you had to include
Two points:
Can you execute your results on a local system or Taurus? If not, we have a Quadro V100 in our dev system. I can execute the benchmarks and send you the results.
By the way, I was aware about the wrong results on the serial backend in the reduce benchmark. I think, it is a precession problem of float and the many summations on a single value. But I had no time yet to investigate this.