trees set sforint ++ inserts end) )there are several versions of eraseint eraseconst object )iterator eraseiterator itr )iterator eraseiterator startiterator end )the first one-parameter erase removes (if foundand returns the number of items actually removedwhich is obviously either or the second one-parameter erase behaves the same as in vector and list it removes the object at the position given by the iteratorreturns an iterator representing the element that followed itr immediately prior to the call to eraseand invalidates itrwhich becomes stale the two-parameter erase behaves the same as in vector or listremoving all the items starting at startup to but not including the item at end for searchingrather than contains routine that returns boolean variablethe set provides find routine that returns an iterator representing the location of the item (or the endmarker if the search failsthis provides considerably more informationat no cost in running time the signature of find is iterator findconst object constby defaultordering uses the less function objectwhich itself is implemented by invoking operatorfor the object an alternative ordering can be specified by instantiating the set template with function object type for instancewe can create set that stores string objectsignoring case distinctions by using the caseinsensitivecompare function object coded in figure in the following codethe set has size set ss insert"hello) insert"hello)cout <"the size is< size<endlmaps map is used to store collection of ordered entries that consists of keys and their values keys must be uniquebut several keys can map to the same values thus values need not be unique the keys in the map are maintained in logically sorted order the map behaves like set instantiated with pairwhose comparison function refers only to the key thus it supports beginendsizeand emptybut the underlying iterator is key-value pair in other wordsfor an iterator itr*itr is of type pair the map also supports insertfindand erase for insertone must provide pair object although find requires only keythe like setan optional template parameter can be used to specify comparison function that differs from less