C++ Monthly Highlights – Issue 11

C++ Monthly Highlights - Issue 11

This month’s C++ topic overview! (2025-08) 1. Structured Binding Variables Do Not Trigger NRVO #include <iostream>#include <tuple>#include <utility> struct T { T() = default; T(const T&) { std::cout << "Copy constructor called\n"; } T(T&&) noexcept { std::cout << "Move constructor called\n"; }}; std::pair<int, T> foo() { return {std::piecewise_construct, std::forward_as_tuple(42), std::forward_as_tuple()};} T func() { auto [x, … Read more

Comprehensive Analysis of C++ Modifiers: A Deep Dive from Basic Types to Modern Compile-Time Features

Comprehensive Analysis of C++ Modifiers: A Deep Dive from Basic Types to Modern Compile-Time Features

Table of Contents 1. Overview of Type Modifiers 2. Basic Type Modifiers • signed/unsigned • short/long/long long • Combination Usage Rules 3. Storage Class Modifiers • auto (Changes before and after C++11) • register • static • extern • mutable 4. Type Qualifiers • const • volatile • constexpr (C++11) 5. Access Modifiers • public/private/protected … Read more

C++ Notes: Const Correctness and Immutability Design

C++ Notes: Const Correctness and Immutability Design

Master the correct usage of the const keyword, establish a mindset for immutability design, improve code quality and safety, and avoid common pitfalls in const usage. 🎯 Use Cases • API Design: Provide const guarantees for function parameters and return values • Class Design: Distinguish between const and non-const member functions • Thread Safety: Use … Read more

10 Code Snippets to Quickly Review Core C++ Concepts (Review + Practical Use)

10 Code Snippets to Quickly Review Core C++ Concepts (Review + Practical Use)

Sometimes when writing C++, you may find that knowledge points you have learned are easily forgotten after a while. For example, does <span>std::move</span> actually empty the object? Does the iterator become invalid when a <span>vector</span> is resized? These questions can seem abstract when looking at the documentation, but a few lines of code can immediately … Read more

Mastering the Essence of C++ Class Design: static and const Methods

Mastering the Essence of C++ Class Design: static and const Methods

Series: In-Depth C++ Advanced Programming 🤔 Do You Really Understand static and const? // 😵 Common Confusing Code class ConfusingClass { private: static int count; // Does this need to be defined outside the class? const int value; // Can this be initialized outside the constructor? static const int MAX; // Can this be initialized … Read more

New Features in C++17: Structured Bindings, if constexpr, and the Filesystem Library

New Features in C++17: Structured Bindings, if constexpr, and the Filesystem Library

C++17 introduces a series of new features that make programming more concise and efficient. This article will detail three important new features: structured bindings, <span>if constexpr</span>, and the filesystem library. We will demonstrate the usage of these features through example code. 1. Structured Bindings What are Structured Bindings? Structured bindings allow us to destructure multiple … Read more