C++17 In Detail

Hi there!

My name is Bartek, I'm a programmer from Cracow/Poland. This is my blog about C++ and native coding.

Quick jump links:

14 September 2020

How I Improved My Legacy C++ Project with PVS-Studio


Since a few months, I’ve been refactoring my old C++/OpenGL project. Thus far, I used compilers (MSVC and Clang), my knowledge or free tools. At some point, I also got a chance to leverage a solid static analysis tool - PVS-Studio. The tool helped me with identifying 8 critical issues not to mention good code style and performance enhancements (in total 137 warnings)

Read on to see my report.

07 September 2020

Replacing unique_ptr with C++17's std::variant a Practical Experiment

Some time ago I wrote about a new way to implement runtime polymorphism which is based not on virtual functions but on std::visit and std::variant. Please have a look at this new blog post where I experiment with this approach on my home project. The experiment is more practical than artificial examples.

See advantages, disadvantages and practical code issues.

31 August 2020

6 Efficient Things You Can Do to Refactor a C++ Project

C++ Refactor Techniques

I took my old pet project from 2006, experimented, refactored it and made it more "modern C++". Here are my lessons and six practical steps that you can apply in your projects.

Let’s start

24 August 2020

C++17: Polymorphic Allocators, Debug Resources and Custom Types

In my previous article on polymorphic allocators, we discussed some basic ideas. For example, you’ve seen a pmr::vector that holds pmr::string using a monotonic resource. How about using a custom type in such a container? How to enable it? Let’s see.

10 August 2020

How to Check String or String View Prefixes and Suffixes in C++20

Up to (and including) C++17 if you wanted to check the start or the end in a string you have to use custom solutions, boost or other third-party libraries. Fortunately, this changes with C++20.

See the article where I’ll show you the new functionalities and discuss a couple of examples.

07 August 2020

C++ Lambda Week: Some Tricks

We’re on the last day of the lambda week. We have all the essential knowledge, and now we can learn some tricks!

06 August 2020

C++ Lambda Week: Going Generic

We’re in the third day of the lambda week. So far, you’ve learned basic syntax and how to capture things. Another important aspect is that lambdas can also be used in the “generic” scenarios. This is especially possible since C++14 where we got generic lambdas (auto arguments), and then in C++20, you can even specify a template lambda!

05 August 2020

C++ Lambda Week: Capturing Things

We’re in the second day of the lambda week. Today you’ll learn about the options you have when you want to capture things from the external scope. Local variables, global, static, variadic packs, this pointer… what’s possible and what’s not?

04 August 2020

Lambda Week: Syntax changes, C++11 to C++20

Let’s start the week with Lambda Expressions. The plan is to have a set of concise articles presenting core elements of lambda expressions. Today you can see how the syntax has evolved since C++11 and what the latest changes in C++20 are.

03 August 2020

C++ Lambda Story is 100% Complete

I’m pleased to announce that I’ve finished the work on the latest update for C++ Lambda Story! This makes the book complete now, and I can finally set its status to 100%! Read on to see the latest changes. It got more than 50 new pages!

27 July 2020

See My Talk: Empty Base Class Optimisation, [[no_unique_address]] and other C++20 Attributes

no_unique_address, C++20, presentation

Last Tuesday, 21th July, I had a pleasure to talk about [[no_unique_address]] on our Cracow C++ User Group online meeting.

Here are the slides and additional comments from the presentation.

13 July 2020

5 Curious C++ Lambda Examples: Recursion, constexpr, Containers and More

Please have a look at my quick blog post where I’ll show you a few interesting lambda examples. Do you know how to write a recursive lambda? Store them in a container? Or invoke at compile time?

See in the article

29 June 2020

Polymorphic Allocators, std::vector Growth and Hacking

The concept of a polymorphic allocator from C++17 is an enhancement to standard allocators from the Standard Library.

It’s much easier to use than a regular allocator and allows containers to have the same type while having a different allocator, or even a possibility to change allocators at runtime.

Let’s see how we can use it and hack to see the growth of std::vector containers.

22 June 2020

The C++ Lambda Story Book

Lambda Expressions appeared in C++11, and since then they become one of the most distinguishing features of Modern C++. What’s more, with each revision of the Standard the ISO Committee improved the syntax and capabilities of lambdas, so they are even more comfortable to use.

Read on to see how you can learn all the details of this powerful modern C++ feature.

© 2017, Bartlomiej Filipek, Blogger platform
Disclaimer: Any opinions expressed herein are in no way representative of those of my employers. All data and information provided on this site is for informational purposes only. I try to write complete and accurate articles, but the web-site will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.