C++C++14C++17C++20Learn C++Syntax

How To Use Tuple Addressing Via Type In C++14 And Beyond

The tuple ( std::tuple ) is a class template that stores the different types of elements, it also supports empty lists in modern C++. This template was introduced in C++11 and improved in C++14. In this post, we explain tuple addressing via type features that come with the C++14 standard. What is std::tuple in C++? The tuple ( std::tuple) is a class template a fixed-size collection of…
Read more
C++C++11C++14C++17C++20Learn C++Syntax

What Is make_unique And How To Use With unique_ptr In C++

Allocating memory and freeing it safely is hard if you are programming a very big application. In Modern C++ there are smart pointers that help avoid the mistake of incorrectly freeing the memory addressed by pointers. Smart pointers make it easier to define and manage pointers, they came with C++11. The most used types of C++ smart pointer areunique_ptr, auto_ptr, shared_ptr, and weak_ptr.
Read more
C++C++14C++17C++20Generic ProgrammingLearn C++Syntax

Learn How To Use Generic Lambdas In Modern C++

Lambda Expressions allow users to write an inline expression that can be used for short snippets of code in your C++ app which are not going to be reused and don’t require naming. The Lambda Expression construct is introduced in C++ 11 and further developed in the C++14, C++17, and C++20 standards. In C++14, lambda expressions are improved by the generalized lambda (generic lambda) or…
Read more
C++C++11C++14C++17C++20Learn C++Syntax

What Is Weak Compare and Exchange In Modern C++?

Since the C++11 standard, the Concurrency Support Library includes built-in support for threads (std::thread) with atomic operations (std::atomic). C++11 provides both weak and strong compare-and-exchange operations in multi-threading applications. Since C++11, weak compare and exchange are used in modern C++ standards such as C++14, C++17, C++20, and in other new standards. In this post, we…
Read more