C++C++11C++14C++17Learn C++Templates

Allowing move constructors to throw with std::move_if_noexcept

In a modern C++ code compiler, there are many features that help you learn, master, and remember the various features and functions of the C++ language. One such feature of modern C++ is the move constructor that allows you to move the resources from one object to another without copying them. The C++11 standard provides an alternative to std::move, which is std::move_if_noexcept, to solve some…
Read more
C++C++11C++14C++17C++20Learn C++Syntax

What Is An Explicit Conversion Operator In Modern C++?

In modern C++, explicit-qualified conversion functions work in the same context as explicit-qualified constructors and produce diagnostics in the same contexts as constructors do. C++11, C++17, and C++20 standards have improvements in this explicit specifier. This is done to avoid situations when the compiler uncomplainingly accepts code that is not semantically correct. In this post, we answer…
Read more
C++C++11C++14C++17C++20Introduction to C++Learn C++Syntax

Learn How To Use The Final Specifier In Modern C++

Modern C++ has many additions compared to the original C++ standard. Regarding virtual overrides, C++11 tends to tighten the rules, to detect some problems that often arise. To achieve this goal C++11 introduces two new contextual keywords, the final and the override. The final specifier (keyword) is used for a function or for a class that cannot be derived and overridden by derived classes. This…
Read more
C++C++11C++14C++17C++20

What Is The '>>' Right-Angle Bracket Support In C++?

C++11 brings a lot of improvements over C++98. In C++98, two consecutive right-angle brackets (>>) give an error, and these constructions are treated according to the C++11 standard which means CLANG compilers no longer generate an error about right angle brackets. In this post, we explain this and how to solve the right-angle bracket problem in C++. What is the right-angle bracket problem in…
Read more