What Are The Useful Mutex, Shared Mutex and Tuple Features In Modern C++

Hello C++ Developers, Embarcadero and Whole Tomato developer teams are working hard on to release of RAD Studio 12, and it seems like we may (or not) see the early released version of the new C++ compiler before 2024. The new 64-bit Clang Toolchain in RAD Studio 12 may have a new bcc64x C++ compiler. The news is amazing. Before it comes, let’s keep learning some modern C++ features to heat up from now on.

This week, we have 3 more modern C++ features that can be used in C++ Builder. The concurrency support library in modern C++ is designed to allow your programs to read and write data securely in thread operations allowing us to develop faster multi-thread code. There are differences between mutual exclusion (std::mutex) and shared mutex (std::shared_mutex) and in another post, we explain these. The tuple (std::tuple) was introduced in C++11 and improved in C++14. In the last post, we explain tuple addressing via type features that come with the C++14 standard.

Our educational LearnCPlusPlus.org site has a broad selection of new and unique posts with examples suitable for everyone from beginners to professionals alike. It is growing well thanks to you, and we have many new readers, thanks to your support! The site features a treasure-trove of posts that are great for learning the features of modern C++ compilers with very simple explanations and examples.

RAD Studio’s C++ BuilderDelphi, and their free community editions C++ Builder CE, and Delphi CE are powerful tools for modern application development.

Do you want to know some news about C++ Builder 12?

RAD Studio, C++ Builder 12 may come with a new C++ compiler that has 64bits Windows CLANG 15.x based compiler. If you want to discover what’s coming in the next RAD Studio 12. Secure your spot from this link now: https://ow.ly/NZFQ50PVL13

image 3145966

Some of the technical features are:

  • Uses Clang 15
  • Uses LLVM’s lld as the linker
  • Emits COFF64 object files (note this means Delphi can also emit COFF64 object files in 12.0: the compiler option “-jf:coff” is specified by our targets files when the “-JL” or “-JPHN[E]” options are specified)
  • Emits PDB format debug info
  • Uses the Itanium ABI (not Microsoft ABI)
  • Uses LLVM’s libc++ STL
  • Uses UCRT for the C runtime
  • Uses a mix of LLVM and MinGW for the C++ runtime
  • Targets Win64
  • Named bcc64x

Here are more details about it,

How to use modern C++ with C++ Builder?

In modern C++, the concurrency support library is designed to solve read and write data securely in thread operations that allow us to develop faster multi-thread apps. This library includes built-in support for threads (std::thread), atomic operations (std::atomic), mutual exclusion (std::mutex), condition variables (std::condition_variable), and many other features.  In C++14, in addition to mutex, there is a shared_mutex which is an instance of the class located in  header. In the first post, we explain using shared mutexes locking in Modern C++.

There are differences between mutual exclusion (std::mutex) which comes with C++11 and shared mutex (std::shared_mutex) which comes with C++14 standards. In the next post, we explain a frequently asked mutex question in modern C++, what are the differences between mutex and shared_mutex?

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 the last post, we explain tuple addressing via type features that come with the C++14 standard.

How to learn modern C++ for free using C++ Builder?

LearnCPlusPlus.org has been producing full of educational daily articles about C and modern C++ that can be used with C++ Builder, C++ Builder CE, Dev-C++, BCC Compiler and some other compilers such as the GCC compiler. Here are our post picks for today.

We like to hear your feedback. You motivate us so much with your likes and comments on social media (find us on Facebook, LinkedIn, Reddit, Twitter / X and all over) and here on the blogs too. Thank you for your valuable comments and questions. All of them help improve the quality of our future posts.

We have a lot of unique posts waiting to come. We keep adding new topics every week about C++ in general and specific topics for C++ Builder, Dev-C++, and for the other C++ compilers. Please keep following our LearnCPlusPlus.org website for the latest posts and updates. Feel free to comment and share with your colleagues, students, members – knowledge is power, and knowledge shared is empowering.

Where I can I learn C++ and test these examples with a free C++ compiler?

If you don’t know anything about C++ or the C++ Builder IDE, don’t worry, we have a lot of great, easy to understand examples on the LearnCPlusPlus.org website and they’re all completely free. Just visit this site and copy and paste any examples there into a new Console, VCL, or FMX project, depending on the type of post. We keep adding more C and C++ posts with sample code. In today’s round-up of recent posts on LearnCPlusPlus.org, we have new articles with very simple examples that can be used with:

Read the FAQ notes on the CE license and then simply fill out the form to download C++ Builder 11 CE.

What Are The Useful Mutex Shared Mutex and Tuple Features In Modern C++ C++ Builder logo

C++ Builder is the easiest and fastest C and C++ IDE for building everything from simple to professional applications. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise version.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition