Hello, my name is Jonathan Boccara. I'm your host on Fluent C++. I have been a C++ developer for 6 years, working for Murex which is a major software editor in the finance industry. My focus is on C++ and particularly how to write expressive code. I'm happy to take your feedback, don't hesitate to drop a comment on a post, follow me or get in touch directly !
Jonathan Boccara's blog
The ink is dry on C++17!
Actually it had dried a few times already. But the drier the ink, the sooner we get to use this new standard in production code.
Now how do we learn all those new additions to the language? And how do we know to use them to write even more expressive code?
We’ve been thinking about that lately with Bartek from bfilipek.com, and we came up with something.
We’re going to make you CRAM new C++17 features into your code, and make it as expressive as can be! It’s time for a new challenge: the…
Coding challenges are a fun way to learn together. You may have participated to a couple of them on Fluent C++ already. But this time Bartek and I are organizing a joint challenge simultaneously on the two blogs.
I’m thrilled about this challenge because you can find useful resources on C++17 on Bartek’s blog (he has been very intense on C++17 lately), and Fluent C++ has growing contents about writing expressive C++. This is as much material to put into practice to write expressive C++17!
So the purpose of this challenge is to write a piece of code that contains as many features of C++17 as possible, and that is as clear as possible.
Definitely. With compilers catching up recently (Clang 5 came out just a fortnight ago), and the ink barely dry enough so that you don’t smudge it when you touch it, not many people actually have C++17 in production today.
But as Raoul Borges says, C++17, like Winter, is Coming.
So we need to learn it, and we’d better start now as C++17 adds a lot of new features. Plus, knowing what features are coming in the language show us the direction the language is steering to. And whatever the version we use now, knowing this is helpful for making our current code follow this direction right away, to fit into the bigger picture of C++ and write better code.
So what is this challenge exactly?
The task proposed in the challenge is to write a command line tool that takes in a CSV file, overwrites all the data of a given column by a given value, and outputs the results into a new CSV file.
More specifically, this command line tool should accept the following arguments:
For instance, if the CSV file had a column “City” with various values for the entries in the file, calling the tool with the name of the input file,
London and the name of output file would result in a copy of the initial file, but with all cities set equal to “London”:
Here is how to deal with edge cases:
In both cases, there shouldn’t be any output file generated.
And if the program succeeds but there is already a file having the name specified for output, the program should overwrite this file.
If you’d like to write code directly on the page you can use this tech.io playground (this is used for coding, not for submitting – see below for how to submit your solution via Coliru):
We do hope you have fun and learn things when coding up your solution. If you want to learn more about C++17, Bartek’s blog has a ton of useful information about it. A good starting point is his collaborative post on C++17 features. And to get inspired on writing expressive code, the contents of Fluent C++ are waiting for you.
It’s time to write some code now! Should you have any question of feedback, don’t hesitate to get in touch with either one of us.
Happy coding!Share this post!     Don't want to miss out ? Follow: