CS106L Lecture 3: C++11 List Initialization and Lvalues vs Rvalues

CS106L Lecture 3: C++11 List Initialization and Lvalues vs Rvalues

Hello everyone, today we will look at Lecture 3 of CS106L Spring 2025, which mainly introduces initialization, references, lvalues and rvalues, as well as the const qualifier. Starting with a Bug Today I took on a development requirement to set the directory path in a static member function of a class in a configurable way. … Read more

C++ Learning Manual – New Features 48 – Concurrency Programming (std::thread, std::async)

C++ Learning Manual - New Features 48 - Concurrency Programming (std::thread, std::async)

In modern computer architecture, concurrency programming has become a key technology for enhancing application performance. The C++11 standard introduced powerful support for concurrency programming, allowing developers to write multithreaded programs in a more intuitive and safer manner. Among these, <span>std::thread</span> and <span>std::async</span> are two of the most important tools for concurrency programming. 1. Why is … Read more

Exploring Static Variables in C++11 Lazy Singleton Pattern

Exploring Static Variables in C++11 Lazy Singleton Pattern

The singleton pattern in C++11 is one of the best practices we are familiar with. It utilizes the characteristics of static variables to safely implement lazy initialization, thread safety, and automatic memory management with very concise code. The implementation of the lazy singleton pattern in C++11 is roughly as follows: #include <iostream> class Singleton { … Read more

Comparison of Features Across C++ Versions from C++98 to C++23

Comparison of Features Across C++ Versions from C++98 to C++23

Core Feature List of Major C++ Versions (Only the most critical changes in the standard are listed for quick reference): C++98 / C++03 (C++98 is the first ISO standard, C++03 is a technical revision, essentially the same) • Standard Template Library (STL): vector, list, map, algorithm, etc. • Exception handling <span>try / catch</span> • Namespaces … Read more

C++ Learning Manual – New Features 46 – Lambda Expressions

C++ Learning Manual - New Features 46 - Lambda Expressions

In the world of C++ programming, we have always pursued more concise, flexible, and powerful expressions. The introduction of Lambda expressions is one of the significant gifts brought to us by C++11. It has fundamentally changed the way we define and use function objects, making the code more elegant and efficient. What are Lambda Expressions? … Read more

C++ Learning Manual – New Features: Range-based For Loop

C++ Learning Manual - New Features: Range-based For Loop

The C++11 standard introduced a series of modern features, among which the range-based for loop is undoubtedly one of the most popular and easiest to grasp. It greatly simplifies the syntax for iterating over elements in containers (such as arrays, vectors, lists, etc.), making the code clearer, more concise, and safer. This article will delve … Read more

CMake: Set Language Standard (Part One)

CMake: Set Language Standard (Part One)

Introduction: Programming languages have different standards, and enabling a new standard is achieved by setting appropriate compiler flags. First, let’s understand the relevant features of C++ 11. For information on setting language features, please refer to the previous or earlier articles regarding CMakeLists.txt, which also cover this topic! ✦ C++ Standard History✦ In 1998, the … Read more

82 Pages Modern C++ Tutorial: Quickly Get Started with C++ 11/14/17/20

82 Pages Modern C++ Tutorial: Quickly Get Started with C++ 11/14/17/20

Machine Heart Report Editor: Chen Ping C++ is an ancient yet novel language. What new features does modern C++ have? This book will take you through it. Since its invention, C++ has undergone multiple revisions, each adding new features and making some modifications. Looking back at the history of C++, it took more than a … Read more

Implementing a Read-Write Spinlock in C++11 – Part 3 (Sequential Lock)

Implementing a Read-Write Spinlock in C++11 - Part 3 (Sequential Lock)

The previous article introduced a read-write lock implementation scheme where writers are not starved by readers who come later, ensuring fairness for writers competing for the lock with readers. This article introduces a special type of read-write spinlock that guarantees the highest priority for write operations. Specifically, when there is only one writer, meaning there … Read more

Introduction to Multithreading in C++11 (Part 1)

Introduction to Multithreading in C++11 (Part 1)

Introduction This series is written because I found my programming skills to be lacking, so I wanted to create a blog to help myself review. I hope it can help everyone (and not mislead too much). If you have any questions, feel free to point them out in the comments. The environment for this article … Read more