C++ For C# Developers: Part 51 – Missing Library Features

Despite the C++ Standard Library having 13 articles worth of content, there’s still quite a bit that it doesn’t contain compared to what’s available in C#’s .NET libraries. Today we’ll look at some of those gaps and see how to fill them.

Read the rest of this article »

C++ For C# Developers: Part 50 – I/O Library

We’ve seen a bit of I/O in the C Standard Library already, but this isn’t C++’s main way to perform I/O. Today we’ll look at the “streams” API that’s designed around C++’s support for strong types and overloaded operators rather than facilities like “format strings.” We’ll also see how to write the canonical “Hello, world!” program in C++ and how to finally implement DebugLog!

Read the rest of this article »

C++ For C# Developers: Part 49 – Ranges and Parallel Algorithms

Generic algorithms have been available in C++ for decades, but the last two versions of the language have really ramped up the functionality. C++17 added support for parallel execution of generic algorithms to easily take advantage of multi-core CPUs. Then C++20 added support for ranges, a composable version of generic algorithms that’s even closer to LINQ in C#. Today we’ll explore both of these!

Read the rest of this article »

C++ For C# Developers: Part 48 – Algorithms Library

The C++ Standard Library’s algorithms are culmination of a lot of C++ language and library features. They’re like a much more featureful, much faster version of LINQ in C#. This powerful combination makes most “raw” loops unnecessary as they can be replaced by named function calls that are well-tested and often compile to the same machine code as a “raw” loop. Read on to learn about them!

Read the rest of this article »

C++ For C# Developers: Part 47 – Containers Library Wrapup

We’ve covered all the individual container types, so let’s take a step back and look at the containers library as a whole. A lot of features, like support for range-based for loops and allocator customization, are supported in all container types. Today we’ll take a look at the commonalities between the containers and see what ties them together into a cohesive library.

Read the rest of this article »

C++ For C# Developers: Part 46 – Other Containers Library

Array-like containers aren’t the only containers we need. Today we’ll look at the non-array containers the C++ Standard Library provides, including its equivalents of Dictionary, HashSet, and LinkedList.

Read the rest of this article »

C++ For C# Developers: Part 45 – Array Containers Library

We use certain container types, like maps and dynamic arrays, constantly. Others, like linked lists and queues, more sparingly. Still, they are fundamental structures in virtually every program and the poster children for generic programming. Like C#, the Standard Library in C++ provides a bunch of container types. Today we’ll start going through them, starting with containers for various kinds of arrays!

Read the rest of this article »

C++ For C# Developers: Part 44 – Strings Library

C++ string literals may be simple arrays of characters, but the Standard Library provides a lot of support on top of that. From a string class to regular expressions, we have a full set of tools to deal with strings in a wide variety of ways.

Read the rest of this article »

C++ For C# Developers: Part 43 – Threading Library

As C# includes classes like Thread and Mutex, the C++ Standard Library also provides support for multi-threading. Classes like std::thread and std::mutex are very similar, but there are larger differences when it comes to C#’s lock, async, and await keywords. Read on to learn how to write multi-threaded C++!

Read the rest of this article »

C++ For C# Developers: Part 42 – Numbers Library

There are so many kinds of numbers we deal with on a regular basis and the C++ Standard Library has a full suite of tools to deal with them. Today we’ll look into random numbers, ratios, mathematical constants, bit manipulation, complex numbers, and more!

Read the rest of this article »