I l@ve RuBoard Previous Section Next Section

includes()

includes() returns true if every element of the second sequence is contained within the first sequence; otherwise, it returns false. Both sequences must be sorted, either by the default less-than operator or by the same operation passed as an optional fifth parameter.



#include <algorithm> 


   int ia1[] = { 13, 1, 21, 2, 0, 34, 5, 1, 8, 3, 21, 34 }; 


int ia2[] = { 21, 2, 8, 3, 5, 1 }; 





// includes must be passed sorted containers 


sort( ia1, ia1+12 ); sort( ia2, ia2+6 ); 


res = includes( ia1, ia1+12, ia2, ia2+6 ); // true 
    I l@ve RuBoard Previous Section Next Section