Between 2018 and 2020, I released several articles with top 5 proposals just around a new ISO C++ meeting happened. Since March 2020, this pattern broke as the meeting went online. Why not restart the series? :) We can look at the recent papers from a whole Quarter.
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.
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.
Currently, as of C++20, there’s no support for so called non-terminal variadic arguments. For example, we cannot write:
template <class ...Args> void func(Args&& ...args, int num=42); func(10, 20); // error As you can see, I wanted 10 and 20 to be passed as ...args and 42 as a default value for num.
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.
Thanks to lots of CPU cores available even in basic computer system we can significantly speed up compilation our projects. In a new article, you can look at techniques and experiments with building things faster in C++ Builder and a well-known free IDE DevC++.
This is an adapted guest post by Eli M and supported by Embarcadero.
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?
While C++11 is with us for a decade now, it’s good to go back and recall some of its best features. Today I’d like to consider override and final keywords which add a crucial safety when you build class hierarchies with lots of virtual member functions.
See how to prevent common bugs, and how to leverage tools to make your code safer.
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 :)
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.
In Visual Studio, when you work with types from the C++ Standard Library or other common APIs, you might be familiar with a concise view of those objects in debugger. You can hover a mouse over an entity, and then the debugger presents short information about their current state. For example:
While 2020 was a crazy and hard year we were fortunate - C++20 was accepted and published, and the work on new features continues.
As usually every year, here’s my overview of the year: the standardization process, features, implementation, compilers, tools, books and more.
2020 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012.