Partners: KDAB Whole Tomato Software CppDepend

09 July 2018

Menu Class - Example of Modern C++17 STL features

Writing articles about modern C++ features is a lot of fun, but what’s even better is to see how you use those new things in real world.

Today I’m happy to present a guest post article from JFT who was so kind to describe his project where he uses several C++17 features.
He shared the process of building a menu that is based on std::any, std::variant and std::optional.

Have a look!

02 July 2018

Parallel STL And Filesystem: Files Word Count Example

Parallel algorithms and Filesystem

Last week you might have read about a few examples of parallel algorithms. Today I have one more application that combines the ideas from the previous post.

We’ll use parallel algorithms and the standard filesystem to count words in all text files in a given directory.

25 June 2018

Examples of Parallel Algorithms From C++17

Examples of Parallel STL from C++17

MSVC (VS 2017 15.7, end of June 2018) is as far as I know the only major compiler/STL implementation that has parallel algorithms. Not everything is done, but you can use a lot of algorithms and apply std::execution::par on them!

Have a look at few examples I managed to run.

18 June 2018

Everything You Need to Know About std::any from C++17

Using std::any in C++17

With std::optional you can represent some Type or nothing. With std::variant you can wrap several variants into one entity. And C++17 gives us one more wrapper type: std::any that can hold anything in a type-safe way.

11 June 2018

A Wall of Your std::optional Examples

std::optional contest

Two weeks ago I asked you for help: I wanted to build a wall of examples of std::optional. I’m very grateful that a lot of you responded and I could move forward with the plan!

You’re amazing!

Let’s dive in the examples my readers have sent me!

04 June 2018

Everything You Need to Know About std::variant from C++17

Using std::variant in C++17

Around the time C++17 was being standardized I saw magical terms like “discriminated union”, “type-safe union” or “sum type” floating around. Later it appeared to mean the same type: “variant”.

Let’s see how this brand new std::variant from C++17 works and where it might be useful.

28 May 2018

Show me your code: std::optional

std::optional contest

Show me your code!

I’d like to run a little experiment.

Let’s build a wall of examples of std::optional!

21 May 2018

Error Handling and std::optional

Error handling and std::optional

In my last two posts in the C++17 STL series, I covered how to use std::optional. This wrapper type (also called “vocabulary type”) is handy when you’d like to express that something is ‘nullable’ and might be ‘empty’. For example, you can return std::nullopt to indicate that the code generated an error… but it this the best choice?

14 May 2018

C++ Templates - The Complete Guide 2nd Book Review

C++ Templates - The Complete Guide 2nd Book review

A few months ago I received a quite massive mail package with something that was looking like a brand new C++ book :)

My initial plan was to review it quickly, maybe in one month. But I failed, as learning C++ templates is not that easy :) I needed much more time.

Time passed by and now I am ready for the review, so here you have it :) See my thoughts about the fantastic book on C++ templates, “the templates book” as many people call it.

07 May 2018

Using C++17 std::optional

Using std::optional, C++

Let’s take a pair of two types <YourType, bool> - what can you do with such composition?

In this article, I’ll describe std:optional - a new helper type added in C++17. It’s a wrapper for your type and a flag that indicates if the value is initialized or not. Let’s see where it can be useful and how you can use it.

23 April 2018

Refactoring with C++17 std::optional

Refactoring with C++17 std::optional

There are many situations where you need to express that something is “optional” - an object that might contain a value or not. You have several options to implement such case, but with C++17 there’s probably the most helpful way: std::optional.

For today I’ve prepared one refactoring case where you can learn how to apply this new C++17 feature.

09 April 2018

Productive C++ Developer, my recent talk

C++ Goodies and tools

A few weeks ago I gave another talk at my local C++ user group. We discussed recent “goodies” from C++ and tools that can increase productivity.

01 April 2018

Deprecating Raw Pointers in C++20

Raw pointers in C++

The C++ Standard moves at a fast pace. Probably, not all developers caught up with C++11/14 yet and recently we got C++17. Now it’ time to prepare C++20!
A few weeks ago The C++ Committee had an official ISO meeting in Jacksonville, FL (12-17 March 2018) where they worked hard on the new specification.

Besides many significant things that were discussed at the meeting like modules, concepts, ranges, The C++ Committee accepted one hugely anticipated feature: deprecation of raw pointers!

26 March 2018

The C++ Standard Library book - overview & giveaway

Let’s have a quick overview of another book related to Modern C++ and The Standard Library. This time I picked Rainer Grimm’s book the author of the modernescpp blog.

Read more if you’d like to win C++ book bundle! :)

© 2017, Bartlomiej Filipek, Blogger platform
Any opinions expressed herein are in no way representative of those of my employers.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.