What's Next

You started with one line of cout. Here is what you can use now:

  • Basics: variables, data types, constants, input, operators, math functions and integer limits
  • Control flow: if, switch, the ternary operator, and for, while and do-while loops
  • Functions: parameters, return values, references, scope, overloading and recursion
  • Arrays and strings: arrays, 2D arrays, strings, characters and string functions
  • Vectors: adding, inserting and removing values, vectors in functions, 2D vectors
  • Pointers and memory: pointers, and heap memory with new and delete
  • Classes: enums, structs, constructors, encapsulation, static members, operator overloading, inheritance, polymorphism, abstract classes and smart pointers
  • Templates: your own function templates and class templates
  • The standard library: pairs, maps, sets, unordered maps, stacks, queues, priority queues, iterators, algorithms, lambdas and exceptions

That is the core of modern C++.

Picking a container

Choosing where to keep the data is one of the first decisions in most programs. This table sums up the containers from the course:

You needUse
values in order, found by indexvector
a value for each key, keys sortedmap
a value for each key, fast, no orderunordered_map
each value only onceset or unordered_set
the last value added comes out firststack
the first value added comes out firstqueue
the largest value always comes out firstpriority_queue

When you are not sure, start with a vector.

What to learn next

  • Move semantics. When a function returns a big vector, C++ can move the data to the caller instead of copying it. You used move with smart pointers. Next, learn what it really does and when it makes a program faster.
  • Programs in many files. Real programs split their code into header files (.h) and source files (.cpp). A build tool compiles them together.
  • A real project. Build a small game or a tool that is too big for one file. You will use almost everything from this course.
  • Practice problems. Coding interview problems use the tools from this course again and again: vectors, maps, sets, stacks, queues, sort and binary_search. Solve a few every week.

The best habit from this course is simple: run the code, look at what really happened, and learn from the surprises.

The last question asks you to pick the right container for a job. Then you have finished the course. Well done!