jagomart
digital resources
picture1_14 C   Stl


 188x       Filetype PDF       File size 1.90 MB       Source: courses.cs.washington.edu


File: 14 C Stl
l14 c stl cse333 summer 2018 c standard template library cse 333 summer 2018 instructor hal perkins teaching assistants renshugu william kim soumya vasisht l14 c stl cse333 summer 2018 ...

icon picture PDF Filetype PDF | Posted on 31 Jan 2023 | 2 years ago
Partial capture of text on file.
                                          L14:  C++ STL                    CSE333, Summer 2018
         C++ Standard Template Library
         CSE 333 Summer 2018
         Instructor:      Hal Perkins
         Teaching Assistants:
         RenshuGu              William Kim          Soumya Vasisht
                                                              L14:  C++ STL                                     CSE333, Summer 2018
         C++’s Standard Library
         v C++’s Standard Library consists of four major pieces:
               1) The entire C standard library
               2) C++’s input/output stream library
                   •  std::cin, std::cout, stringstreams, fstreams, etc.
               3) C++’s standard template library (STL)  ☜
                   •  Containers, iterators, algorithms (sort, find, etc.), numerics
               4) C+’+’s miscellaneous library
                   •  Strings, exceptions, memory allocation, localization
                                                                                                                               2
                                       L14:  C++ STL                  CSE333, Summer 2018
      STL Containers J
      v A container is an object that stores (in memory) a 
         collection of other objects (elements)
         § Implemented as class templates, so hugely flexible
         § More info in C++ Primer §9.2, 11.2
      v Several different classes of container
         § Sequencecontainers (vector, deque, list, ...)
         § Associative containers (set, map, multiset, multimap, 
            bitset, ...)
         § Differ in algorithmic cost and supported operations
                                                                               3
                                       L14:  C++ STL                   CSE333, Summer 2018
      STL Containers L
      v STL containers store by value, not by reference
         § When you insert an object, the container makes a copy
         § If the container needs to rearrange objects, it makes copies
            • e.g. if you sort a vector, it will make many, many copies
            • e.g. if you insert into a map, that may trigger several copies
         § What if you don’t want this (disabled copy constructor or copying 
            is expensive)?
            • You can insert a wrapper object with a pointer to the object
               – We’ll learn about these “smart pointers” soon
                                                                                4
The words contained in this file might help you see if this file matches what you are looking for:

...L c stl cse summer standard template library instructor hal perkins teaching assistants renshugu william kim soumya vasisht s v consists of four major pieces the entire input output stream std cin cout stringstreams fstreams etc containers iterators algorithms sort find numerics miscellaneous strings exceptions memory allocation localization j a container is an object that stores in collection other objects elements implemented as class templates so hugely flexible more info primer several different classes sequencecontainers vector deque list associative set map multiset multimap bitset differ algorithmic cost and supported operations store by value not reference when you insert makes copy if needs to rearrange it copies e g will make many into may trigger what don t want this disabled constructor or copying expensive can wrapper with pointer we ll learn about these smart pointers soon...

no reviews yet
Please Login to review.