SDL Resources
This page brings all our SDL content together. Easily browse through structured courses or standalone lessons.
Complete Courses
We've created complete courses for focused learning. Explore the list below to find the right one for you.
Course One
First Lesson
No upcoming lessons available.
Course Two
First Lesson
No upcoming lessons available.
Course Three
First Lesson
No upcoming lessons available.
Full Lesson List
Here's a full list of all our lessons. New content is added often and we make regular improvements and updates to existing lessons.
This Week
Content added or updated in the last 7 days
Automatic Type Deduction using auto
This lesson covers how we can ask the compiler to infer what types we are using through the auto
keyword
The SDL Library and Cross-Platform Development
An introduction to the SDL library, the problem it solves, and why we're using it to learn C++
Errors as Values and std::expected
Learn how to handle errors as values in C++23 using the std::expected
type
Removal Algorithms
An overview of the key C++ standard library algorithms for removing objects from containers. We cover remove()
, remove_if()
, remove_copy()
, and remove_copy_if()
.
Using std::erase()
and std::erase_if()
A guide to the C++20 std::erase()
and std::erase_if()
functions, which simplify the remove-erase idiom for standard library containers
This Month
Content added or updated in the last 30 days
Setting up a C++ Development Environment
Getting our computer set up so we can create and build C++ programs. Then, creating our very first application
Creating Variables
Creating variables to store and update the data that describes our objects. We also introduce comments, allowing us to describe our code in plain language.
Booleans - true
and false
values
An overview of the fundamental true or false data type, how we can create them, and how we can combine them.
Switch Statements
Learn an alternative way to write conditionals, which is often used when we want to take different paths based on a specific value
Encapsulation and Access Specifiers
A guide to encapsulation, class invariants, and controlling data access with public
and private
specifiers.
Working with Inherited Members
This lesson provides an in-depth exploration of using inherited methods and variables in C++, covering constructor calls, variable modification, and function shadowing
Function return
Statements
Allow our functions to communicate with their caller by returning values when they complete
Dynamic Arrays using std::vector
Explore the fundamentals of dynamic arrays with an introduction to std::vector
Memory Ownership and Smart Pointers
Learn how to manage dynamic memory using unique pointers and the concept of memory ownership
Managing Memory Manually
Learn the techniques and pitfalls of manual memory management in C++
Snake Movement and Navigation
Learn how to implement core snake game mechanics including movement, controls, and state management
Namespaces
Learn the essentials of using namespaces to organize your code and handle large projects with ease
Introduction to SDL_Image
Learn to load, manipulate, and save various image formats using SDL_Image
.
SDL2 Timers and Callbacks
Learn how to use callbacks with SDL_AddTimer()
to provide functions that are executed on time-based intervals
Type Aliases
Learn how to use type aliases and utilities to simplify working with complex types.
Type Deduction Using decltype
and declval
Learn to use decltype
and std::declval
to determine the type of an expression at compile time.
Friend Classes and Functions
An introduction to the friend
keyword, which allows classes to give other objects and functions enhanced access to its members
Implicit Conversions and Narrowing Casts
Going into more depth on what is happening when a variable is used as a different type
Function Arguments and Parameters
Making our functions more useful and dynamic by providing them with additional values to use in their execution
Abstraction and Classes
Learn how to define, instantiate, and utilize classes, understanding how they form the backbone of object-oriented programming.
Constructors and Destructors
Learn about special functions we can add to our classes, control how our objects get created and destroyed.
Attributes
Explore the fundamentals of attributes, including [[nodiscard]]
, [[likely]]
, and [[deprecated]]
Creating SDL2 Buttons
Learn to create interactive buttons in SDL2 and manage communication between different UI components.
Creating Custom Events
Learn how to create and manage your own game-specific events using SDL's event system.
Ending and Restarting Games
Implement win/loss detection and add a restart feature to complete the game loop
Placing Flags
Implement flag placement and tracking to complete your Minesweeper project.
Multiple Windows and Utility Windows
Learn how to manage multiple windows, and practical examples using utility windows.
Positioning and Rendering Entities
Updating our TransformComponent
and ImageComponent
to support positioning and rendering
Creating a Physics Component
Integrate basic physics simulation into entities using a dedicated component
Creating a Collision Component
Enable entities to detect collisions using bounding boxes managed by a dedicated component.
Collision Response
Make entities react realistically to collisions, stopping, bouncing, and interacting based on type.
Breakout: Project Setup
Begin building a Breakout clone by integrating our level editor and engine into a new game project.
Breakout: The Ball
This lesson focuses on creating the Ball
class, customizing our physics engine, and launching the ball.
Breakout: Walls and Collision
We'll add invisible walls around the play area and write the collision response code to make the ball bounce.
Breakout: The Player Paddle
We'll build the player's paddle, hook it up to keyboard controls, and keep it from moving off-screen.
Breakout: Improving Paddle Physics
We'll add detailed collision logic to the paddle, giving the player control over the ball's trajectory.
Breakout: Loading Levels
Add breakable bricks to the game by loading and parsing level files saved from our level editor.
Breakout: Game Progression
Implement the core gameplay loop of destroying blocks and advancing through levels using SDL events.
Breakout: Final Touches
Learn to manage game states for winning, losing, and pausing, and prepare the final game for distribution.
Class Templates
Learn how templates can be used to create multiple classes from a single blueprint
Compile-Time Evaluation
Learn how to implement functionality at compile-time using constexpr
and consteval
Iterator and Range-Based Algorithms
An introduction to iterator and range-based algorithms, using examples from the standard library
This Year
Content added or updated in the last 12 months
Operator Overloading
This lesson introduces operator overloading, a fundamental concept to create more intuitive and readable code by customizing operators for user-defined types
References
This lesson demystifies references, explaining how they work, their benefits, and their role in performance and data manipulation
The this
Pointer
Learn about the this
pointer in C++ programming, focusing on its application in identifying callers, chaining functions, and overloading operators.
Type Objects
Learn to create flexible game entities using the Type Object pattern for data-driven design.
Types From Data Files
Learn to load game object types and instances from external text files
Copy Semantics and Return Value Optimization
Learn how to control exactly how our objects get copied, and take advantage of copy elision and return value optimization (RVO)
Inheritance
In this lesson, we explore C++ inheritance, guiding you through creating and managing class hierarchies to streamline your code
Copy Constructors and Operators
Explore advanced techniques for managing object copying and resource allocation
Constants and const
-Correctness
Learn the intricacies of using const
and how to apply it in different contexts
Effective Comments and Javadoc
This lesson provides an overview of effective commenting strategies, including Javadoc style commenting for automated documentation
Installing vcpkg on Windows
An introduction to C++ package managers, and a step-by-step guide to installing vcpkg on Windows and Visual Studio.
Shared Pointers using std::shared_ptr
An introduction to shared memory ownership using std::shared_ptr
Level Editor Starting Point
Establish the core structure for our level editor, including window, scene, and asset management.
Building the Actor Menu
This lesson focuses on creating the UI panel for Actors and adding the first concrete Actor type.
Click and Drag Actors
Implement clicking and dragging actors from the menu, showing a tooltip that follows the mouse cursor.
Placing Actors in the Level
Build the level container, add logic for placing actors via drag-and-drop, including visual hints.
Moving, Selecting, and Deleting Actors
Add core interactions: drag actors to reposition them, click to select, and press delete to remove them.
Grid-Based Placement
Convert the freeform placement to a grid-based system with snapping and single-actor cell limits
Saving Your Editor Levels
Implement footer buttons and binary serialization to save and load your custom game levels to disk.
Loading Saved Levels
Complete the save/load cycle by implementing level deserialization using SDL_RWops and actor factories.
Implementing a Component System
Create the C++ framework for adding, retrieving, and removing components from game entities.
Dates, Times and Durations
Learn the basics of the chrono library and discover how to effectively manage durations, clocks, and time points
Mouse Input Basics
Discover how to process mouse input, including position tracking and button presses
Rectangles and SDL_Rect
Learn to create, render, and interact with basic rectangles using the SDL_Rect
and SDL_Color
types.
Structuring SDL Programs
Discover how to organize SDL components using manager classes, inheritance, and polymorphism for cleaner code.
Weak Pointers with std::weak_ptr
A full guide to weak pointers, using std::weak_ptr
. Learn what they're for, and how we can use them with practical examples
Move Semantics
Learn how we can improve the performance of our types using move constructors, move assignment operators and std::move()
Value Categories (L-Values and R-Values)
A straightforward guide to l-values and r-values, aimed at helping you understand the fundamentals
Types and Literals
Explore how C++ programs store and manage numbers in computer memory, including integer and floating-point types, memory allocation, and overflow handling.
Setting up SDL2 in Windows (Visual Studio)
A step-by-step tutorial on configuring SDL2, SDL_image and SDL_ttf in a Visual Studio C++ project on Windows
Setting up SDL2 in macOS (Xcode or CMake)
This step-by-step guide shows you how to set up SDL2 in an Xcode or CMake project on macOS
Building SDL2 from a Subdirectory (CMake)
A step-by-step guide on setting up SDL2 and useful extensions in a project that uses CMake as its build system
Building SDL2 from Source (GCC and Make)
This guide walks you through the process of compiling SDL2, SDL_image, and SDL_ttf libraries from source
Creating a Window
Learn how to create and customize windows, covering initialization, window management, and rendering
SDL Surfaces and Colors
Explore SDL surfaces, the canvases for drawing, understand pixel formats, colors, and set your window's background.
Detecting and Managing Errors
Discover techniques for detecting and responding to SDL runtime errors
Implementing an Application Loop
Step-by-step guide on creating the SDL2 application and event loops for interactive games
Double Buffering
Learn the essentials of double buffering in C++ with practical examples and SDL2 specifics to improve your graphics projects
Understanding Screen & World Space
Learn to implement coordinate space conversions in C++ to position game objects correctly on screen.
Discrete and Continuous Values
Learn how to handle floating point precision issues when programming game physics and transformations between coordinate spaces.
Cameras and View Space
Create camera systems that follow characters, respond to player input, and properly frame your game scenes.
Creating an Input Component
Implement player controls and AI actions cleanly using the Command pattern
Smart Pointers and std::unique_ptr
An introduction to memory ownership using smart pointers and std::unique_ptr
in C++
Building with Components
Learn how composition helps build complex objects by combining smaller components
Entity and Component Interaction
Explore component communication, dependency management, and specialized entity types within your ECS
Creating an Image Component
Display graphics by creating an ImageComponent that loads files and renders them via SDL_image.
Asset Management
Optimize image loading using shared pointers and an asset manager for better memory use and simpler code.
Image and Entity Scaling
Add width, height, and scaling modes to our entities and images
Preprocessor Definitions
Explore the essential concepts of C++ preprocessing, from understanding directives to implementing macros
Bounding Boxes
Discover bounding boxes: what they are, why we use them, and how to create them
Intersections and Relevancy Tests
Optimize games by checking object intersections with functions like SDL_HasIntersection()
.
Handling Object Collisions
Implement bounding box collision detection and response between game objects
Dynamic Memory and the Free Store
Learn about dynamic memory in C++, and how to allocate objects to it using new
and delete
Objects, Variables and Types
An introduction to the building blocks of our software - objects, and the variables that can be associated with them.
Introduction to Functions
Learn the basics of writing and using functions in C++, including syntax, parameters, return types, and scope rules.
Namespaces, Includes, and the Standard Library
A quick introduction to namespaces in C++, alongside the standard library and how we can access it
Conditionals and Loops
Learn the fundamentals of controlling program flow in C++ using if statements, for loops, while loops, continue, and break
Classes, Structs and Enums
A crash tour on how we can create custom types in C++ using classes, structs and enums
Preprocessor Directives and the Build Process
Learn the fundamentals of the C++ build process, including the roles of the preprocessor, compiler, and linker.
Understanding Reference and Pointer Types
Learn the fundamentals of references, pointers, and the const
keyword in C++ programming.
Operator Overloading
Discover operator overloading, allowing us to define custom behavior for operators when used with our custom types
Run-time Polymorphism
Learn how to write flexible and extensible C++ code using polymorphism, virtual functions, and dynamic casting
Odds and Ends: 10 Useful Techniques
A quick tour of ten useful techniques in C++, covering dates, randomness, attributes and more
Building a 2D Vector Type
Learn the foundations of vector math to work with positions and movements, and create a custom type to apply these concepts
Physical Motion
Create realistic object movement by applying fundamental physics concepts
Force, Drag, and Friction
Learn how to implement realistic forces like gravity, friction, and drag in our physics simulations
Momentum and Impulse Forces
Add explosions and jumping to your game by mastering momentum-based impulse forces
Introduction to Debugging
Creating a tiny program using numbers and booleans, then adding some breakpoints so we can step through our code in a debugger.
Creating and Calling Functions
An introduction to functions - reusable blocks of code that we can use to break our application into smaller pieces.
Forward Declarations
Understand what function prototypes are, and learn how we can use them to let us order our code any way we want.
The Modulus Operator (%
)
Learn how we can use the modulus operator to get the remainder of integer division, and some common use cases.
Structured Binding
This lesson introduces Structured Binding, a handy tool for unpacking simple data structures
The #include
Directive
Discover how the #include
directive helps us include library features and split our project across multiple files.
Header Files
Explore how header files and linkers streamline C++ programming, learning to organize and link our code effectively
The using
Keyword
This lesson introduces the using
keyword in C++, focusing on namespaces, enums, and type aliasing
Variables, Types and Operators
Learn the fundamentals of C++ programming: declaring variables, using built-in data types, and performing operations with operators
Brightness and Gamma
Learn how to control display brightness and gamma correction using SDL's window management functions
Scene Rendering
Create a scene management system that converts world space coordinates to screen space for 2D games.
Memory Management and the Stack
Learn about stack allocation, limitations, and transitioning to the Free Store
Algorithm Analysis and Big O Notation
An introduction to algorithms - the foundations of computer science. Learn how to design, analyze, and compare them.
Moving Objects with Vectors
Explore how to use vectors for representing positions, directions, and implementing speed-limited movement in games.
The Call Stack and Debugging Functions
An introduction to how our function calls create a call stack, and how we can navigate it in a debugger.
Conditional Logic
Use booleans and if statements to make our functions and programs more dynamic, choosing different execution paths.
Function Overloading
This lesson provides an in-depth look at function overloading in C++, covering its importance, implementation, and best practices
Static Casting
Explore the concept of static casting in C++, including examples and best practices for converting data types at compile time
Virtual Functions and Overrides
This lesson provides an introduction to virtual functions and overrides, focusing on their role in enabling runtime polymorphism
Downcasting
Get to grips with downcasting in C++, including static and dynamic casts. This lesson provides clear explanations and practical examples for beginners
Numeric and Binary Data
Learn how C++ represents numbers and data in memory using binary, decimal, and hexadecimal systems.
Exponents and cmath
Understand the math foundations needed for game programming in C++, including power and root functions.
Spaces, Vectors and Coordinates
Learn the fundamentals of coordinate systems and vectors to create spatial representations
Angles and Distance
Learn key geometry concepts like angles, triangles, and vectors to implement distance calculations.
Using std::terminate()
and the noexcept
Specifier
This lesson explores the std::terminate()
function and noexcept
specifier, with particular focus on their interactions with move semantics.
Snake Game Core Components
Introducing the foundational components for our game and setting up the project
Building the Snake Grid
Build the foundational grid structure that will power our Snake game's movement and collision systems.
Snake Growth
Allowing our snake to eat apples, and grow longer each time it does
Pausing and Restarting
Giving our Snake game the ability to pause itself, and adding a clickable button for restarting the game
Win/Loss Logic for Snake
Add game-ending logic to our Snake game with custom events, state management, and visual cues for player feedback.
Building the Score Display
Build a dynamic score counter that tracks the player's progress and displays it with custom graphics and text.
Animating Snake Movement
Learn to animate the snake's movement across cells for a smooth, dynamic visual effect.
Customising Mouse Cursors
Learn how to control cursor visibility, switch between default system cursors, and create custom cursors
Parsing Data using std::string
Learn how to read, parse, and use config files in your game using std::string
and SDL_RWops
Writing Data to Files
Learn to write and append data to files using SDL2's I/O functions.
Read/Write Offsets and Seeking
Learn how to manipulate the read/write offset of an SDL_RWops
object to control stream interactions.
Mouse Capture and Global Mouse State
Learn how to track mouse movements and button states across your entire application, even when the mouse leaves your window.
Working with Data
Learn techniques for managing game data, including save systems, configuration, and networked multiplayer.
Byte Order and Endianness
Learn how to handle byte order in using SDL's endianness functions
Padding and Alignment
Learn how memory alignment affects data serialization and how to handle it safely
Fullscreen Windows
Learn how to create and manage fullscreen windows in SDL, including desktop and exclusive fullscreen modes.
Display Modes
Learn how to manage screen resolutions and refresh rates in SDL games using display modes.
Pixel Density and High-DPI Displays
Learn how to create SDL applications that look great on modern displays across different platforms
Window Decorations and Borders
An introduction to managing SDL2 window decorations, borders, and client areas.
Window Titles
Learn how to set, get, and update window titles dynamically
Window Opacity
Discover how to use SDL2 functions for controlling and retrieving window transparency settings.
Video Displays
Learn how to handle multiple monitors in SDL, including creating windows on specific displays.
Window Configuration
Explore window creation, configuration, and event handling using SDL's windowing system
Window Events and Window IDs
Discover how to monitor and respond to window state changes in SDL applications
Managing Window Position
Learn how to control and monitor the position of SDL windows on screen
Window Sizing
Learn how to resize, constrain, and manage SDL2 windows
Window Visibility
Learn how to control the visibility of SDL2 windows, including showing, hiding, minimizing, and more
Mouse Input Constraints
Implement mouse constraints in SDL2 to control cursor movement using window grabs and rectangular bounds
Relative Mouse Mode
Learn how to restrict cursor movement to a window whilst capturing mouse motion continuously.
Handling Keyboard Input
Learn how to detect and respond to keyboard input events in your SDL-based applications. This lesson covers key events, key codes, and modifier keys.
Managing Window Input Focus
Learn how to manage and control window input focus in SDL applications, including how to create, detect, and manipulate window focus states.
Understanding Keyboard State
Learn how to detect and handle keyboard input in SDL2 using both event-driven and polling methods. This lesson covers obtaining and interpreting the keyboard state array.
Handling Mouse Scrolling
Learn how to detect and handle mouse scroll wheel events in SDL2, including vertical and horizontal scrolling, as well as scroll wheel button events.
Managing Mouse Focus with SDL2
Learn how to track and respond to mouse focus events in SDL2, including handling multiple windows and customizing focus-related click behavior.
Mouse State
Learn how to monitor mouse position and button states in real-time using SDL's state query functions
Delegates and the Observer Pattern
An overview of the options we have for building flexible notification systems between game components
Pointers to Members
Learn how to create pointers to class functions and data members, and how to use them
Function Binding and Partial Application
This lesson covers function binding and partial application using std::bind()
, std::bind_front()
, std::bind_back()
and std::placeholders
.
Fold Expression
An introduction to C++17 fold expressions, which allow us to work more efficiently with parameter packs
Tick Rate and Time Deltas
Learn how to create smooth, time-aware game loops that behave consistently across different hardware configurations
High-Resolution Timers
Learn to measure time intervals with high accuracy in your games
Callbacks and Function Pointers
Learn to create flexible and modular code with function pointers
Member Function Pointers and Binding
Explore advanced techniques for working with class member functions
Reading Data from Files
Learn how to read and parse game data stored in external files using SDL_RWops
Engine Overview
An introduction to the generic engine classes we'll use to create the game
Dangling Pointers and References
Learn about an important consideration when returning pointers and references from functions
Loading and Displaying Images
Learn how to load, display, and optimize image rendering in your applications
Cropping and Positioning Images
Learn to precisely control image display using source and destination rectangles.
Image Scaling and Aspect Ratios
Learn techniques for scaling images and working with aspect ratios
Rendering Text with SDL_ttf
Learn to render and manipulate text in SDL2 applications using the official SDL_ttf
extension
Text Performance, Fitting and Wrapping
Explore advanced techniques for optimizing and controlling text rendering when using SDL_ttf
Creating the Grid
Building a two-dimensional grid of interactive minesweeper cells
Adding Bombs to the Grid
Updating the game to to place bombs randomly in the grid and render them when cells are cleared.
Adjacent Cells and Bomb Counting
Implement the techniques for detecting nearby bombs and clearing empty cells automatically.
User Input in the Terminal
This lesson introduces the fundamentals of capturing user input, using std::cin
and std::getline()
Output Streams
A detailed overview of C++ Output Streams, from basics and key functions to error handling and custom types.
String Streams
A detailed guide to C++ String Streams using std::stringstream
. Covers basic use cases, stream position seeking, and open modes.
Input Streams
A detailed introduction to C++ Input Streams using std::cin
and std::istringstream
. Starting from the basics and progressing up to advanced use cases including creating collections of custom objects from our streams.
Regular Expressions
An introduction to regular expressions, and how to use them in C++ with std::regex
, std::regex_match
, and std::regex_search
Regex Capture Groups
An introduction to regular expression capture groups, and how to use them in C++ with regex_search
, regex_replace
, regex_iterator
, and regex_token_iterator
String Views
A practical introduction to string views, and why they should be the main way we pass strings to functions
Working with String Views
An in-depth guide to std::string_view
, including their methods, operators, and how to use them with standard library algorithms
Older
Content added or updated in previous years
Characters, Unicode and Encoding
An introduction to C++ character types, the Unicode standard, character encoding, and C-style strings
Working with C-Style Strings
A guide to working with and manipulating C-style strings, using the <cstring>
library
A Deeper Look at the std::string
Class
A detailed guide to std::string
, covering the most essential methods and operators
Manipulating std::string
Objects
A practical guide covering the most useful methods and operators for working with std::string
objects and their memory
Templates and Header Files
Learn how to separate class templates into declarations and definitions while avoiding common linker errors
Run Time Type Information (RTTI) and typeid()
Learn to identify and react to object types at runtime using RTTI, dynamic casting and the typeid()
operator
The Spaceship Operator and Expression Rewriting
A guide to simplifying our comparison operators using C++20 features
C++20 Modules
A detailed overview of C++20 modules - the modern alternative to #include
directives. We cover import
and export
statements, partitions, submodules, how to integrate modules with legacy code, and more.
List, Aggregate, and Designated Initialization
A quick guide to creating objects using lists, including std::initializer_list
, aggregate and designated initialization
User Defined Conversions
Learn how to add conversion functions to our classes, so our custom objects can be converted to other types.
User Defined Literals
A practical guide to user-defined literals in C++, which allow us to write more descriptive and expressive values
Mutable Class Members
An introduction to the mutable
keyword, which gives us more flexibility when working with const
objects.
Multiple Inheritance and Virtual Base Classes
A guide to multiple inheritance in C++, including its common problems and how to solve them
Pure Virtual Functions
Learn how to create interfaces and abstract classes using pure virtual functions
Internal and External Linkage
A deeper look at the C++ linker and how it interacts with our variables and functions. We also cover how we can change those interactions, using the extern
and inline
keywords
Static Class Variables and Functions
A guide to sharing values between objects using static class variables and functions
Comparison Algorithms
An introduction to the eight main comparison algorithms in the C++ Standard Library
The Reduce and Accumulate Algorithms
A detailed guide to generating a single object from collections using the std::reduce()
and std::accumulate()
algorithms
C++23 Fold Algorithms
An introduction to the 6 new folding algorithms added in C++23, providing alternatives to std::reduce
and std::accumulate
Working with the File System
Create, delete, move, and navigate through directories and files using the std::filesystem
library.
File System Paths
A guide to effectively working with file system paths, using the std::filesystem::path
type.
Directory Iterators
An introduction to iterating through the file system, using directory_iterator
and recursive_directory_iterator
.
File Streams
A detailed guide to reading and writing files in C++ using the standard library's fstream
type
Replacement Algorithms
An overview of the key C++ standard library algorithms for replacing objects in our containers. We cover replace()
, replace_if()
, replace_copy()
, and replace_copy_if()
.
Partition Algorithms
An introduction to partitions, and the C++ standard library algorithms that create them
Set Algorithms
An introduction to set algorithms, and how to implement them using the C++ standard library
Minimum and Maximum Algorithms
An introduction to the seven minimum and maximum algorithms in the C++ standard library: clamp()
, min()
, min_element()
, max()
, max_element()
, minmax()
, and minmax_element()
.
Movement Algorithms
An introduction to the seven movement algorithms in the C++ standard library: move()
, move_backward()
, rotate()
, reverse()
, shuffle()
, shift_left()
, and shift_right()
.
Copying Algorithms
An introduction to the 7 copying algorithms in the C++ standard library: copy()
, copy_n()
, copy_if()
, copy_backward()
, reverse_copy()
, rotate_copy()
, and unique_copy()
.
Search Algorithms
An introduction to the 8 main searching algorithms in the C++ standard library, including find()
, find_if()
, find_if_not()
, find_first_of()
, adjacent_find()
, search_n()
, search()
, and find_end()
.
Binary Search in C++
An introduction to the advantages of binary search, and how to use it with the C++ standard library algorithms binary_search()
, lower_bound()
, upper_bound()
, and equal_range()
Counting Algorithms
An introduction to the 5 main counting algorithms in the C++ standard library: count()
, count_if()
, any_of()
, none_of()
, and all_of()
Standard Library Views
Learn how to create and use views in C++ using examples from std::views
Creating Views using std::ranges::subrange
This lesson introduces std::ranges::subrange, allowing us to create non-owning ranges that view some underlying container
8 Key Standard Library Algorithms
An introduction to 8 more useful algorithms from the standard library, and how we can use them alongside views, projections, and other techniques
Parallel Algorithm Execution
Multithreading in C++ standard library algorithms using execution policies
Creating Custom Iterators using C++20 Concepts
A detailed guide to implementing a custom iterator type from scratch, using modern recommended techniques
Projection Functions
Learn how to use projection functions to apply range-based algorithms on derived data
Iterators and Ranges
This lesson offers an in-depth look at iterators and ranges, emphasizing their roles in container traversal
Implementing Ranges for Custom Types
Learn to implement iterators in custom types, and make them compatible with range-based techniques.
Defining Ranges using Sentinels
An alternative way of defining ranges, and why we sometimes need to use them
Variadic Functions
An introduction to variadic functions, which allow us to pass a variable quantity of arguments
Perfect Forwarding and std::forward
An introduction to problems that can arise when our functions forward their parameters to other functions, and how we can solve those problems with std::forward
Trailing Return Types
An alternative syntax for defining function templates, which allows the return type to be based on their parameter types
Recursion and Memoization
An introduction to recursive functions, their use cases, and how to optimize their performance
Standard Library Function Helpers
A comprehensive overview of function helpers in the standard library, including std::invocable
, std::predicate
and std::function
.
First Class Functions
Learn about first-class functions in C++: a feature that lets you store functions in variables, pass them to other functions, and return them, opening up new design possibilities
Function Pointers
Learn about function pointers: what they are, how to declare them, and their use in making our code more flexible
Function Objects (Functors)
This lesson introduces function objects, or functors. This concept allows us to create objects that can be used as functions, including state management and parameter handling.
Hashing and std::hash
This lesson provides an in-depth look at hashing in C++, including std::hash
, collision strategies, and usage in hash-based containers.
Hash Sets using std::unordered_set
This lesson provides a thorough understanding of std::unordered_set
, from basic initialization to handling custom types and collisions
Using std::pair
Master the use of std::pair
with this comprehensive guide, encompassing everything from simple pair manipulation to template-based applications
Hash Maps using std::unordered_map
Creating hash maps using the standard library's std::unordered_map
container
Linked Lists using std::forward_list
This lesson provides an in-depth exploration of std::forward_list
, covering creation, management, and advanced list operations
Multidimensional Arrays and std::mdspan
A guide to std::mdspan
, allowing us to interact with arrays as if they have multiple dimensions
Data Structures and Algorithms
This lesson introduces the concept of data structures beyond arrays, and why we may want to use alternatives.
Static Arrays using std::array
An introduction to static arrays using std::array
- an object that can store a collection of other objects
C-Style Arrays
A detailed guide to working with classic C-style arrays within C++, and why we should avoid them where possible
Array Spans and std::span
A detailed guide to creating a "view" of an array using std::span
, and why we would want to
Storing and Rethrowing Exceptions
This lesson offers a comprehensive guide to storing and rethrowing exceptions
Nested Exceptions
Learn about nested exceptions in C++: from basic concepts to advanced handling techniques
Function Try Blocks
Learn about Function Try Blocks, and their importance in managing exceptions in constructors
Errors and Assertions
Learn how we can ensure that our application is in a valid state using compile-time and run-time assertions.
Exceptions: throw
, try
and catch
This lesson provides an introduction to exceptions, detailing the use of throw
, try
, and catch
.
Exception Types
Gain a thorough understanding of exception types, including how to throw and catch both standard library and custom exceptions in your code
Double-Ended Queues using std::deque
A guide to double-ended queues - a structure that behaves like a vector, specialised for manipulating objects at the edges of the collection
Using JSON in Modern C++
A practical guide to working with the JSON data format in C++ using the popular nlohmann::json
library.
Using HTTP in Modern C++
A detailed and practical tutorial for working with HTTP in modern C++ using the cpr
library.
Binary Serialization using Cereal
A detailed and practical tutorial for binary serialization in modern C++ using the cereal
library.
Priority Queues using std::priority_queue
Learn how to access objects based on their importance, and how to customise how that priority is determined
Introduction to Stacks using std::stack
An introduction to the stack data structure, and the standard library implementation - std::stack
Tuples and std::tuple
A guide to tuples and the std::tuple
container, allowing us to store objects of different types.
Introduction to Queues and std::queue
Learn the fundamentals and applications of queues with the std::queue
container.
Nullable Values, std::optional
and Monadic Operations
A comprehensive guide to using std::optional
to represent values that may or may not be present.
Constrained Dynamic Types using Unions and std::variant
Learn how to store dynamic data types in C++ using unions and the type-safe std::variant
Unconstrained Dynamic Types using Void Pointers and std::any
Learn how to use void pointers and std::any
to implement unconstrained dynamic types, and understand when they should be used
Type Traits: Compile-Time Type Analysis
Learn how to use type traits to perform compile-time type analysis, enable conditional compilation, and enforce type requirements in templates.
Concepts in C++20
Learn how to use C++20 concepts to constrain template parameters, improve error messages, and enhance code readability.
Creating Custom Concepts
Learn how to create your own C++20 concepts to define precise requirements for types, using boolean expressions and requires
statements.
Using Concepts with Classes
Learn how to use concepts to express constraints on classes, ensuring they have particular members, methods, and operators.
Understanding Overload Resolution
Learn how the compiler decides which function to call based on the arguments we provide.
Using SFINAE to Control Overload Resolution
Learn how SFINAE allows templates to remove themselves from overload resolution based on their arguments, and apply it in practical examples.
Member Function Templates
Learn how to create and use member function templates in classes and structs, including syntax, instantiation, and advanced techniques
Template Specialization
A practical guide to template specialization in C++ covering full and partial specialization, and the scenarios where they're useful
Variable Templates
An introduction to variable templates, allowing us to create variables at compile time.
Function Templates
Understand the fundamentals of C++ function templates and harness generics for more modular, adaptable code.
Overloading the <<
Operator
Learn how to overload the <<
operator, so our custom types can stream information directly to the console using std::cout
System Calls and Terminal Management
This lesson introduces system calls, and how to use them to clear the terminal
Bitwise Operators and Bit Flags
Unravel the fundamentals of bitwise operators and bit flags in this practical lesson
Random Number Generation
This lesson covers the basics of using randomness, with practical applications
String Interpolation
A detailed guide to string formatting using C++20's std::format()
, and C++23's std::print()
Style Guides and Automatic Code Formatting
This lesson introduces the concept of Style Guides and ClangFormat, focusing on how to achieve consistency in our code
Static Analysis
An introduction to static analysis tools, and how they can help beginners learn faster and improve code quality
Protected Class Members
Learn about protected
class members in C++, including how and when to use them in your code, especially in the context of inheritance and class design
Member Initializer Lists
This lesson introduces Member Initializer Lists, focusing on their advantages for performance and readability, and how to use them effectively
Structs and Aggregate Initialization
Discover the role of structs, how they differ from classes, and how to initialize them without requiring a constructor.