321x Filetype PDF File size 3.09 MB Source: www.cdeep.iitb.ac.in
CS 101:
Computer Programming and
Utilization
Puru
with
CS101 TAs and Staff
Course webpage: https://www.cse.iitb.ac.in/~cs101/
Lecture 26: Wrap up
CS101 Autumn 2019 @ CSE IIT Bombay
The C++ Standard Library
• Comes with every C++ distribution
• Contains many functions and classes that you are likely to need in
day to day programming
• The classes have been optimized and debugged thoroughly
• If you use them, you may be able to write programs with very little
work
• Highly recommended that you use functions and classes form the
standard library whenever possible
• Files, Strings, Maps, Vectors, Sets, Lists,
Queues …
CS101 Autumn 2019 @ CSE IIT Bombay 2
Key building blocks the library
• Generalized entities available as template classes
–member variables and functions
• C++ support for object oriented programming
–constructors, copy constructors, destructors, operator
overloading, templates …
–Dynamic memory management
CS101 Autumn 2019 @ CSE IIT Bombay 3
heap memory to be handle carefully
int* iptr;
iptr = new int;
*iptr = …;
delete iptr;
*iptr = ...; // dangling reference!
// memory leak // memory leak
int *iptr; { int *iptr;
iptr = new int; iptr = new int;
iptr = new int; }
CS101 Autumn 2019 @ CSE IIT Bombay 4
no reviews yet
Please Login to review.