Skip to content

Latest commit

Β 

History

91 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Lectures and projects for the C++ for yourself course

Icon

Build status Visitors

This repository is a collection of Markdown scripts used for all the videos in the C++ for yourself course.

These can be used to follow-along the video or as a standalone learning material.

πŸ™ Support this work

GitHub Sponsors Audible trial Amazon affiliate links

Please remember that there is a human behind all of this work. I write scripts, create animations, record and edit videos at night after a full-time work day. It is at times hard. But you can make it easier. Here is what you can do:

  • πŸ’Ά Become a sponsor on GitHub!
  • πŸ’Έ Can't support monetarily?
    • πŸ‘ Like the videos and watch them to the end!
    • πŸ’¬ Leave comments on YouTube!
    • πŸ“’ Spread the word among your friends!
    • ⭐️ Star the repo to help others find it!
  • 🀬 Don't like something? πŸ—£οΈ Talk to me about it! I am always eager to improve.

πŸ’‘ How to follow this course

The course is designed to be consumed from top to bottom, so start at the beginning and you will always have enough knowledge for the next video.

That being said, I aim to leave links in the videos so that one could watch them out of order without much hassle.

Enjoy! 😎

πŸ“• C++ for yourself lectures

Video thumbnail
Lecture
Hello World program in C++
Video thumbnail
Lecture
Hello world program dissection

Lecture script

  • First keywords
  • What brackets mean
  • What do different signs mean
  • Intro to "scopes"
  • Intro to functions
  • Intro to includes
No video
Project
Project: hello world program

Homework script

  • Write a simple program that prints Hello World!
  • Learn to compile and run simple programs
Video thumbnail
Lecture
Variables of fundamental types

Lecture script

  • How to create variables of fundamental types
  • Naming variables
  • Using const, constexpr with variables
  • References to variables
Video thumbnail
Lecture
Namespaces for variables

Lecture script

  • Namespaces with variables
  • The word using with variables
Video thumbnail
Lecture
Input/output streams

Lecture script

  • std::cout, std::cerr, std::cin
Video thumbnail
Lecture
Sequence and utility containers

Lecture script

  • Sequence containers: std::array, std::vector, their usage and some caveats
  • Pair container: std::pair
  • Strings from STL: std::string
  • Conversion to/from strings: to_string, stoi, stod, stof, etc.
  • Aggregate initialization
Video thumbnail
Lecture
Associative containers

Lecture script

  • std::map and std::unordered_map
  • Touch up on std::set and std::unordered_set
Video thumbnail
Project
Project: fortune teller program

Homework script

  • Write a program that tells your C++ fortune
  • It reads and writes data from and to terminal
  • Stores and accesses these data in containers
Video thumbnail
Lecture
Control structures

Lecture script

  • if, switch and ternary operator
  • for, while and do ... while
Video thumbnail
Lecture
Random number generation

Lecture script

  • What are random numbers
  • How to generate them in modern C++
  • Why not to use rand()
Video thumbnail
Project
Project: the guessing game

Homework script

  • A program that generates a number
  • The user guesses this number
  • The program tells the user if they are above or below with their guess (or if they've won)
Video thumbnail
Lecture
Compilation flags and debugging

Lecture script

  • Useful compilation flags
  • Debugging a program with:
    • Print statements
    • lldb debugger
Video thumbnail
Lecture
Functions

Lecture script

  • What is a function
  • Declaration and definition
  • Passing by reference
  • Overloading
  • Using default arguments
Video thumbnail
Lecture
Enumerations

Lecture script

  • What are enums
  • How to use them?
  • Why not to use old style enums
Video thumbnail
Lecture
Libraries and header files

Lecture script

  • Different types of libraries
    • Header-only
    • Static
    • Dynamic
  • What is linking
  • When to use the keyword inline
  • Some common best practices
Video thumbnail
Lecture
Build systems introduction

Lecture script

  • Intro to build systems
  • Build commands as a script
  • Build commands in a Makefile
Video thumbnail
Lecture
CMake introduction

Lecture script

  • Build process with CMake
  • CMake Variables
  • Targets and their properties
  • Example CMake project
Video thumbnail
Lecture
Using GoogleTest framework for testing code

Lecture script

  • Explain what testing is for
  • Explain what testing is
  • Show how to download and setup googletest
  • Show how to write a simple test
Video thumbnail
Lecture
Installing projects and using find_project with CMake
Video thumbnail
Project
Project: string processing library

Homework script

  • You will write library that allows to split and trim strings
  • You will learn how to:
    • Write a CMake project from scratch
    • Write your own libraries
    • Test them with googletest
    • Link them to binaries
Video thumbnail
Lecture
Simple custom types with classes and structs

Lecture script

  • Explain why the classes are needed
  • Implement an example game about a car
  • Define classes and structs more formally
Video thumbnail
Lecture
Raw pointers

Lecture script

  • The pointer type
  • Pointers = variables of pointer types
  • How to get the data?
  • Initialization and assignment
  • Using const with pointers
  • Non-const pointer to const data
  • Constant pointer to non-const data
  • Constant pointer to constant data
Video thumbnail
Lecture
Object lifecycle

Lecture script

  • Creating a new object
  • What happens when an object dies
  • Full class lifecycle explained
Video thumbnail
Lecture
Move semantics

Lecture script

  • Why we care about move semantics
  • Let’s re-design move semantics from scratch
  • How is it actually designed and called in Modern C++?
Video thumbnail
Lecture
Constructors, operators, destructor - rule of all or nothing

Lecture script

  • β€œGood style” as our guide
  • What is β€œgood style”
  • Setting up the example
  • Rule 1: destructor
  • Rule 2: copy constructor
  • Rule 3: copy assignment operator
  • Rule 4: move constructor
  • Rule 5: move assignment operator
  • Now we (mostly) follow best practices
  • Rule of 5 (and 3)
  • The rule of β€œall or nothing”
Video thumbnail
Lecture
Headers with classes

Lecture script

  • What stays the same
  • What is different
  • Example to show it all
Video thumbnail
Lecture
Const correctness

Lecture script

  • What is const correctness
  • Some rules and examples to follow in order to work with const correctly
Video thumbnail
Project
Project: pixelate images in terminal

Homework script

  • You will write a library that allows to pixelate an image
  • You will learn how to:
    • Work with classes
    • Use external libraries
      • Read images from disk using stb_image.h
      • Draw stuff in the terminal using FTXUI library
    • Manage memory allocated elsewhere correctly
    • Writing multiple libraries and binaries and linking them together
    • Manage a larger CMake project
Video thumbnail
Lecture
Keyword static outside of classes

Lecture script

  • Why we should not use static outside of classes
  • Relation to storage duration
  • Relation to linkage
  • Why we should use inline instead
Video thumbnail
Lecture
Keyword static inside classes

Lecture script

  • Using static class methods
  • Using static class data
  • What is static in classes useful for?
Video thumbnail
Lecture
Templates: why would we want to use them?

Lecture script

  • Templates provide abstraction and separation of concerns
  • Function templates
  • Class and struct templates
  • Generic algorithms and design patterns
  • Zero runtime cost (almost)
  • Compile-time meta-programming
  • Summary
Video thumbnail
Lecture
Templates: what do they do under the hood?

Lecture script

  • Compilation process recap
  • Compiler uses templates to generate code
  • Hands-on example
  • Compiler is lazy
Video thumbnail
Lecture
How to write function templates

Lecture script

  • The basics of writing a function template
  • Explicit template parameters
  • Implicit template parameters
  • Using both explicit and implicit template parameters at the same time
  • Function overloading and templates
  • Full function template specialization and why function overloading is better
Video thumbnail
Lecture
How to write class templates
Video thumbnail
Lecture
Forwarding references
Video thumbnail
Lecture
Header and source files for templated code
Video thumbnail
Lecture
Almost everything about inheritance
Video thumbnail
Lecture
Memory management and smart pointers
Video thumbnail
Lecture
Lambdas in modern C++
Video thumbnail
Lecture
Error handling in C++
Video thumbnail
Lecture
Dynamic polymorphism with std::variant
Video thumbnail
Lecture
Storing callables with std::function
Video thumbnail
Lecture
Parallelism in modern C++

PS

Most of the code snippets are validated automatically

If you do find an error in some of those, please open an issue in this repo!

Star History Chart

Sponsor this project

Used by

Contributors

Languages