Strong Types in C++: A Concrete Example

When you create a model for your domain, C++ offers you flexibility and increates type-safety with so-called Strong Types. Rather than working with simple built-in types, you can create a set of well-defined classes that better suits your needs. In a new blog post, you can see one concrete example of such a design practice.

READ MORE...

constexpr Dynamic Memory Allocation, C++20

constexpr has become a major feature for compile-time programming in C++. Introduced in a simple form in C++11 evolved into almost another “sub-language”, an alternative to regular template code. In C++20 you can even use std::vector and std::string in constexpr context! In this article, I’d like to discuss constexpr memory allocations, a building block for std::vector.

READ MORE...

Improving Print Logging with Line Pos Info & Modern C++

No matter how proficient you are, I think, you might still use one of the primary methods of debugging: trace values using printf, TRACE, outputDebugString, etc… and then scan the output while debugging. Adding information about the line number and the file where the log message comes from is a very efficient method that might save you a lot of time.

READ MORE...

Implementing Parallel copy_if in C++

In a blog post about a dozen ways to filter elements, I mentioned only serial versions of the code. But how about leveraging concurrency? Maybe we can throw some more threads and async tasks and complete the copy faster? For example, I have 6 cores on my machine, so it would be nice to see, like 5x speedup over the sequential copy?

READ MORE...

C++ Lambda Story in Print

I’m happy to announce the print/paperback version of C++ Lambda Story! After more than a year of updates and smaller changes, the whole project is completed! You can now purchase the book in lots of different formats. See details of this major update and also take part in a giveaway and get the book for free :)

READ MORE...

Visual Studio's Natvis Debugging Framework Tutorial

Last time in A Debugging Tip: Write Custom Visualizers in Visual Studio, I introduced the Visual Studio’s Natvis Framework and showed you a couple of samples. That article was just a basic introduction, and now it’s time to see more experiments. Learn From Existing Code First of all, we can examine existing code that is shipped with Visual Studio and see how it works.

READ MORE...