New Features in C++26: Static Storage with Braced Initializers

New Features in C++26: Static Storage with Braced Initializers

1. Initialization with Braces Using braces for initialization, specifically with std::initializer_list for list initialization, makes the entire program clearer and simpler to implement. However, various situations can arise during this implementation. Although a temporary array is generated for data storage in general, the details of its implementation differ in various cases. With the evolution of … Read more

New Features in C++26: Concepts and Variable Templates as Template Parameters

New Features in C++26: Concepts and Variable Templates as Template Parameters

1. Concepts and Variable Templates Concepts (C++20) and variable templates (C++14) are both introduced in newer standards, so related technical standards may not immediately follow suit. In previous studies, we learned about functions that take other functions as parameters, known as higher-order functions. Similarly, in template programming, there are templates that take templates as parameters, … Read more

New Features in C++26 – Uninitialized Reads

New Features in C++26 - Uninitialized Reads

1. What are Uninitialized Reads Erroneous behaviour for uninitialized reads, or uninitialized reads. In traditional C++, UB (Undefined Behavior) is a very broad term; any behavior that does not fall under normal operations can be considered undefined. This overly broad definition often leads to a problem where, after an issue arises, it is difficult to … Read more

The Journey from C++98 to C++26

The Journey from C++98 to C++26

整理 | 王瑞平As a programmer, the most important topic to focus on in 2023 is the update of the C++ standard.The C++ standard follows a three-year development cycle and is named after the year of release. C++ enters a “feature freeze” one year before its release, meaning the version development enters a semi-stable state, and … Read more

New Features in C++26 – Proof of ADL

New Features in C++26 - Proof of ADL

1. Introduction Previously, we analyzed and provided examples of ADL (Argument Dependent Lookup) in template-related technologies. However, in practical applications, if the iterator is a dangerous pointer type, it will not perform ADL actions. But if it is similar to a template projected type, ADL operations will occur. In the case of the Ranges library, … Read more

C++26 New Feature – Delete Function with Reason Explanation

C++26 New Feature - Delete Function with Reason Explanation

1. C++ Handling of Function Hiding/Deletion In early C++ development, for practical reasons, some functions might be hidden. For example, in certain cases, it may be necessary to prohibit constructors or copy constructors, which can be handled by moving them to private functions. This effectively disables the external interface. However, with the C++11 standard, the … Read more

New Features in C++26 – Multidimensional Array Views

New Features in C++26 - Multidimensional Array Views

1. std::span and std::mdspan In C++20 and C++23, std::span and std::mdspan were introduced, which can be understood as a type of view or slice similar to that in Go language. While this understanding is not entirely precise, it makes it easier for everyone to accept, serving as a compromise. As a multidimensional array view, std::mdspan … Read more

New Features in C++26: inplace_vector

New Features in C++26: inplace_vector

1. inplace_vector inplace_vector may seem a bit odd, as the standard library already includes std::array and std::vector. Why introduce inplace_vector in the standard library? The answer lies in practical application scenarios. For instance, in embedded systems, developers may need some flexible operations of vector but are reluctant to perform dynamic resizing. Using arrays may also … Read more

New Features in C++26 – SIMD

New Features in C++26 - SIMD

1. Flynn’s Taxonomy In the classification of computer architectures, there is a method called Flynn’s Taxonomy, which classifies systems based on the number of instruction streams and data streams. According to Flynn’s Taxonomy, there are the following categories:1. SISD – Single Instruction Single DataIn this model, the instruction unit processes only one instruction, and the … Read more

New Features in C++26

New Features in C++26

1. Compilers and C++ Standards As we all know, the C++ standard is constantly evolving, but regardless of the speed of its formulation, there is always a specific date. Before this date, all related documents may be pending or subject to change. The C++ standard is merely a standard; its true implementation in practice requires … Read more