C++C++11C++14C++17C++20Learn C++

Learn How to Use New And Delete Elisions In C++

The C++14 standard (and later), brings a lot of useful smart pointers and improvements on them. They help us to avoid the mistake of incorrectly freeing the memory addressed by pointers. In modern C++, we have the new and delete operators that are used to allocate and free objects from memory, and in this post, we explain how to use new and delete operators. Can we use new and delete elisions…
Read more
C++C++11C++14C++17Learn C++

What Are Atomic Add And Sub Operations In C++?

The concurrency support library in modern C++ is designed to solve problems in multi-thread operations. Since the C++11 standard, this library includes built-in support for threads (std::thread) with atomic operations (std::atomic). In this post, we explain two atomic operations that can be used with std::atomic types, we explain what are atomic addition and subtraction operations. What is…
Read more
C++C++11C++14C++17C++20IteratorsLearn C++Templates

What Is Atomic (std::atomic) In Modern C++?

In modern C++, the concurrency support library is designed to solve problems in multi-thread operations. This library includes built-in support forthreads (std::thread), atomic operations (std::atomic), mutual exclusion (std::mutex), condition variables (std::condition_variable),and many other features of a modern C++ compiler. In this post, we explain what is std::atomic and how we…
Read more
C++C++11Learn C++

Learn How To Eliminate Unnecessary Copying In C++

In modern C++, rvalue references are a compound type like standard C++ references, which are referred to as lvalue references.New rvalue reference rules were set by the C++11 specifications. In many cases, data is copied that simply needs to be moved, that is, the original data holder need not retain the data. The rvalue reference can be used to distinguish cases that require copying versus…
Read more