thrust::min_element
Defined in thrust/extrema.h
- 
template<typename ForwardIterator>
 ForwardIterator thrust::min_element(ForwardIterator first, ForwardIterator last)
- min_elementfinds the smallest element in the range- [first, last). It returns the first iterator- iin- [first, last)such that no other iterator in- [first, last)points to a value smaller than- *i. The return value is- lastif and only if- [first, last)is an empty range.- The two versions of - min_elementdiffer in how they define whether one element is less than another. This version compares objects using- operator<. Specifically, this version of- min_elementreturns the first iterator- iin- [first, last)such that, for every iterator- jin- [first, last),- *j < *iis- false.- #include <thrust/extrema.h> ... int data[6] = {1, 0, 2, 2, 1, 3}; int *result = thrust::min_element(data, data + 6); // result is data + 1 // *result is 0 - Parameters
- first – The beginning of the sequence. 
- last – The end of the sequence. 
 
- Template Parameters
- ForwardIterator – is a model of Forward Iterator, and - ForwardIterator's- value_typeis a model of LessThan Comparable.
- Returns
- An iterator pointing to the smallest element of the range - [first, last), if it is not an empty range;- last, otherwise.