find maximum value in an array along with index

Yeah, you’re right. I was looking at the documentation http://thrust.googlecode.com/svn/tags/1.2…p__extrema.html which uses an int * directly and so obviously returns an int *. But even then I was wrong, because subtracting the two pointers directly will you give the correct offset, you’ll only get the offset in bytes if you cast the pointers to size_t first.