Innovation... driven by intelligence and logic

102: C++23 Fundamentals and Advanced STL. Course

Module 1: C++ Fundamentals vs...

The Compilation Model:

Preprocessor, compilation, linking. Introduction to Modules (import std;).

Basic I/O & Formatting:

std::print and std::println (C++23).

Type Deduction:

auto, decltype, and initialization styles {}.

Prerequisites & Environment Setup

• Configure a cutting-edge development environment capable of compiling C++23.
• Compiler Requirements
• C++23 features (like std::print, std::flat_map, std::ranges::fold_left) require recent toolchains:
• GCC: Version 13.0+ (GCC 14 recommended).
• Clang: Version 16.0+ (Clang 17/18 recommended).
• MSVC: Visual Studio 2022 v17.6+.

Key Takeaway:

Trainees should be ready for c++23.

Module 2: Modern Foundations & Memory Management

Transitioning from "Manual Memory Management" to "RAII and Semantics".

Type Inference:

auto, decltype, and Structured Bindings (auto [x, y] = point;).

Move Semantics:

Lvalues vs. Rvalues (glvalue, prvalue, xvalue).
Rvalue references (T&&).
Move Constructors and Move Assignment Operators.
std::move vs. std::forward.

Smart Pointers (The end of new/delete):

std::unique_ptr (Exclusive ownership).
std::shared_ptr (Reference counting control blocks).
std::weak_ptr (Breaking circular dependencies).

The Rule of 0, 3, and 5: Managing resource handles correctly.

Key Takeaway

Students will stop using new and delete entirely, relying on RAII (Resource Acquisition Is Initialization) for leak-free code.

Module 3: Advanced STL & Containers

Sequence Containers

These containers store elements in a linear sequence and provide methods for accessing elements by their position. 
std::vector: A dynamic array that can grow or shrink in size. It provides fast random access. (Header: )
std::deque (Double Ended Queue): A double-ended queue that allows for fast insertion and deletion at both the beginning and the end. (Header: )
std::list: A doubly linked list, allowing for very efficient insertion and deletion of elements anywhere in the list, but slow random access. (Header: )
std::forward_list: A singly linked list, which is more memory-efficient than std::list but only allows forward traversal. (Header: )
std::array: A fixed-size array that provides a safe, STL-compliant interface. (Header: )
std::string: While not strictly a container of generic elements, it is a sequence container for characters and is part of the standard library. (Header: ) 

Associative Containers

These containers store elements in a sorted order based on a key and allow for fast retrieval of elements. 
std::set: A collection of unique keys, stored in a specific sorted order. (Header: )
std::multiset: Similar to std::set, but allows duplicate keys. (Header: )
std::map: A collection of key-value pairs, where each key is unique and used to retrieve its associated value. (Header:)
std::multimap: Similar to std::map, but allows duplicate keys. (Header: ) 

Unordered Associative Containers 

These containers store elements in an unordered fashion, using hash tables for very fast insertion and lookup times. 
std::unordered_set: A collection of unique keys stored using a hash table. (Header: )
std::unordered_multiset: Similar to std::unordered_set, but allows duplicate keys. (Header: )
std::unordered_map: A collection of key-value pairs stored using a hash table, where each key is unique. (Header: )
std::unordered_multimap: Similar to std::unordered_map, but allows duplicate keys. (Header: ) 

Container Adaptors

These are not full-fledged containers, but rather provide a different interface to existing sequence containers. 
std::stack: A LIFO (Last-In, First-Out) data structure, typically implemented using std::deque or std::list as the underlying container. (Header: )
std::queue: A FIFO (First-In, First-Out) data structure, typically implemented using std::deque or std::list. (Header: )
std::priority_queue: A queue where the element with the highest priority is always at the front, typically implemented using std::vector. (Header: ) 

Other Key Classes/Components

std::pair: A simple utility structure that stores a pair of objects. (Header: )
std::iterator (and related types like std::istream_iterator, std::ostream_iterator): The foundation for traversal, allowing algorithms to work with different containers uniformly. (Header: )

Function Objects (Functors): Classes that overload the function-call operator (operator()) to behave like functions. (Header: )

Algorithms (e.g., std::sort, std::find, std::reverse): A large collection of global functions that perform operations on ranges of elements. (Header: , , etc.) 


 

Go to Top ^