Lecture 5 - Page 27 : 39
Notes about C++
Templates and The Standard Library
* Templates
Templates
Templates versus generics in Java, C# and C++
Example - Point<C>
Class templates in C++
Example - Point<C,dim,default_value>
Function templates
Policies with Templates
Example of Policies with Templates
Template Specialization
Example - Specialization of Point<C> to Point<char>
Specialization of class templates - complete and partial
Compile time computations with template specialization
* Vector Basics
Vectors - basic use
* Iterators
Iterators seen as generalized pointers
Example uses of iterators - basis stuff
Different classifications of iterators
Categories of iterators
Insert iterators
* Standard Containers
Documentation of the container library
Overview of containers
A priority queue example
A map example
Common properties of containers
Container member types
A vector specialization: vector<bool>
* Algorithms
Documentation of the algorithms library
Overview of Algorithms
Principles used for algorithms
The for-each algorithm
Function objects
Using the sort algorithm
An example of for-each and function objects
Use of function objects in STL
Adapter examples
Common properties of containers
Overall properties of STL containers
The C++ Programming Language
: Page 441
C# counterpart - Collection class hierarchy
No common base class for the standard containers
However, each container provides standard operations with standard names and semantics
Emphasis on iterators
Different kinds of iterators are not related by a common base class
Non-intrusive containers
Elements of containers do no need to be instances of certain classes
Values of built-in types can be elements in container
Standard containers relies heavily on templates
Template specializations provide shared implementations for
pointers
to elements