Introduction to the C++ Standard Template Library (STL)

This series of notes aims to teach how to utilize the standard template library (STL) with examples on a sample of classes and functions that should break the unfamiliarity with the rest of the STL. These notes are provided in parallel with the Data Structures and Algorithms course for the 2nd year students in Biomedical Engineering Department, so in the coming notes, there will be a special focus on STL containers (i.e data structures).

A challenging issue before starting to learn STL for a beginner programmer is the necessity to learn Object Oriented Programming (OOP) as a prerequisite. The first notes therefore will address the basic concepts of OOP.

Also, an important objective is to involve applications that are:

  1. practical, in which students realize the importance of OOP in useful applications. For example, we will avoid traditional examples like the Car Factory analogy, which is a complete example that can span most of the OOP concepts, yet useless in practice, hence boring and might confuse students on the purpose of programming!
  2. biologically related as much as possible with few exceptions.

Notes Outline

Day Topics Ecosystem & Miscellaneous
12/3/2019 Introduction to OOP: classes, encapsulation, methods  
9/4/2019 Introduction to OOP 2: constructors, default arguments, const-correctness in OOP, template classes and template functions, access modifiers, enum types.  
  std::string, std::vector, std::list, std::stack, std::queue, std::array, operator overloading, lambda expression, iterators, range-based iteration, std::find, std::find_if  
  std::map, std::unordered_map, std::move, std::swap, std::sort, std::make_heap  
  std::for_each, std::accumulate, std::distance  

Prerequisites

  • A working machine with a C++ compiler and git.
  • Git basic usage skills.
  • Visual Studio Code.
  • Patience.

Tutorials

  1. Tutorial 1:
  2. Tutorial 2:
  3. Tutorial 3:

Topics covered by this series

Course Outline