11.07.2015 Views

tYSR20

tYSR20

tYSR20

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 28: Standardizing on the Standard Template Library 373{// add a few of students to the students collection -// a map actually stores objects as “pairs” with the// left member being the key and the right the actualobjectStudent* pS;pS = new Student(“Sean Yours”, 3456);Pair* ptr = new Pair(pS->getKey(), pS);students.insert(*ptr);// a map overloads the index operator to create the Pair// and insert it into the map for usstudents[1234] = new Student(“Fresch Man”, 1234);students[5678] = new Student(“Student, Jr.”, 5678);// iterate through the collection of students;// a map is always retained in the sorted order// determined by the SC classcout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!