Template Function thrust::equal(InputIterator1, InputIterator1, InputIterator2)¶
Function Documentation¶
-
template<typename
InputIterator1, typenameInputIterator2>
boolthrust::equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2) equalreturnstrueif the two ranges[first1, last1)and[first2, first2 + (last1 - first1))are identical when compared element-by-element, and otherwise returnsfalse.This version of
equalreturnstrueif and only if for every iteratoriin[first1, last1),*i == *(first2 + (i - first1)).The following code snippet demonstrates how to use
equalto test two ranges for equality.- Return
true, if the sequences are equal;false, otherwise.- Parameters
first1: The beginning of the first sequence.last1: The end of the first sequence.first2: The beginning of the second sequence.
- Template Parameters
InputIterator1: is a model of Input Iterator, andInputIterator1'svalue_typeis a model of Equality Comparable, andInputIterator1'svalue_typecan be compared for equality withInputIterator2'svalue_type.InputIterator2: is a model of Input Iterator, andInputIterator2'svalue_typeis a model of Equality Comparable, andInputIterator2'svalue_typecan be compared for equality withInputIterator1'svalue_type.
#include <thrust/equal.h> ... int A1[7] = {3, 1, 4, 1, 5, 9, 3}; int A2[7] = {3, 1, 4, 2, 8, 5, 7}; ... bool result = thrust::equal(A1, A1 + 7, A2); // result == false