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

What Are The Amazing Containers In Modern C++?

Containers are powerful data storage arrays in modern C++ and they are very useful to iterate and search data with their amazing methods and properties. TheC++ Standardslibrary defines 4 container types. In this post, we explain containers in modern C++. What is a container in modern C++? Containers are modern data storage arrays in modern C++ and they are very useful to iterate…
Read more
CC++C++11C++14C++17C++20Learn C++Syntax

Why Was The Gets Function Removed In C++14?

Modern C++ has a lot of useful functions coming from C. One of them was the gets() function that we use to get string inputs and that we were able to use in C++11 or earlier. In C++14, the gets function was removed, while fgets or other input functions remain there. If you have older C++ code that uses the gets() functions your C++14 version compiler will not compile it. Why was the gets function…
Read more
C++C++11C++14C++17C++20Learn C++

How to Use Atomic_flag In Modern C++?

C++11 allows the use of atomics in signal handlers. In C++17 the signal handler feature is further improved. The std::atomic_flag is an atomic boolean type that is guaranteed to be lock-free and can be used in signal handlers. Moreover, the <csignal> header in C++ has an integer type std::sig_atomic_t that can be accessed as an atomic entity even in the presence of asynchronous…
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