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
C++C++11C++14C++17Learn C++Syntax

Learn Useful Bidirectional Fences In Modern Multi-threading C++ Apps

C++11 improved the support for bidirectional fences in multi-thread applications. In modernC++ development,Fencesare synchronization primitives in multi-threading operations, they are memory barriers in threads, and they can acquire semantics, release semantics, or both. In this post, we explain what are fences and how we can use them. What are bidirectional fences in…
Read more
C++C++11C++14C++17Learn C++Syntax

Learn How To Use User Defined Literal Operators In Modern C++

C++11 introduced new forms of literals using modified syntax and semantics in order to provide User-Defined Literals (UDL) also known as Extensible Literals. Using user-defined literals, user-defined classes can provide new literal syntax and they can be used with the operator "" to combine values with conversion operators. In this post, we explain how to use user-defined literals in modern…
Read more
C++C++11C++14C++17C++20IteratorsLearn C++Syntax

How To Use Functor Object With std::thread In C++?

In modern C++ development we can use multi-thread operations and parallel programming features in our applications in different ways of modern programming features. The std::thread class is a special class defined in <thread> header in the concurrency support library that comes with C++11. We can use the std::thread class in multi-thread operations with functor objects, and in this post…
Read more