Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

difference between lower and upper bound

//a={10, 20, 30, 30, 40, 50, 60}

std::lower_bound returns iterator to first element in the given range 
-which is EQUAL_TO or Greater than val.
//*a.lower_bound(30) = 30 , *a.lower_bound(40) = 40, a.lower_bound(45) = 50     

std::upper_bound returns iterator to first element in the given range 
-which is Greater than val.
//*a.upper_bound(30) = 40 , *a.upper_bound(40) = 50, a.upper_bound(45) = 50

note:- * return the value assoiciated with the iterator;
credit:- for def. user13003546(stackoverflow)
 
PREVIOUS NEXT
Tagged: #difference #upper #bound
ADD COMMENT
Topic
Name
3+6 =