lecture36-apr29 - Lecture 36 Announcements Assignment 7 due...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 36 Announcements Assignment 7 due on Friday; Q&A; more clarifications Sample exam 3 on BB later this week • Exam 3 on Friday, May 8 in class • No final Topics of the day • STL Overview C++ Arrays • An array is a fixed-size collection of values of the same data type. • An array is a composite object that stores the n (size) elements in a contiguous block of memory. • Arrays are direct access in that an index may be used to select any item in the array without referencing any of the other items Array Limitations The size of an array is Fxed at the time of its declaration and cannot be changed during the run time. An array cannot report its size. A separate integer variable is required in order to keep track of its size. C++ arrays do not allow the assignment of one array to another. The copying of an array requires the generation of a loop structure with the array size as an upper bound. No automatic growth/shrinkage to meet the needs of an application. insertion and deletion inside the array requires the costly movement of data either to the right or to the left. EfFcient access to an element requires knowledge of its position in the list. STL The Standard Template Library, or STL, is a C++ library which provides many of the basic algorithms and data structures. The STL is a generic library,that is, almost every component in the STL is a template. It consists of: Container classes Algorithms Iterators Adaptors And a set of other special components: Function Objects Allocators Predicates Comparison functions STL started in the 1970s by Stepanov/Lee at SGI/HP and was accepted into C++ by the ANSI/ISO C++ standards committee in 1994. Programming Guide: http://www.sgi.com/tech/stl/index.html Containers A container is a generic data structure that stores a large collection of elements. It has common operations for adding, removing and accessing elements. The STL provides 10 container classes for solving a wide range of problems. The elements do not have to be stored in any definite order for a given Container type. A container owns it’s elements and they are deallocated when a Container object is destroyed. STL containers are very close to the efficiency of hand-coded, type-specific containers. An iterator is an integral type associated with Containers that can be used to to iterate (cycle) through the Container's elements. Container Types
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/24/2010 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas at Austin.

Page1 / 5

lecture36-apr29 - Lecture 36 Announcements Assignment 7 due...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online