Articles & Books

C++ Compile time conditional struct member variables--Saleem Ahmad

Before we get metaclasses one day?

C++ Compile time conditional struct member variables

by Saleem Ahmad

From the article:

C++ has rich set of features to do compile time calculations and optimizations to generate a better code. In one of code segment I have very large data structure in which few member variables are not used based on compile time if constexpr condition, but these variables are logged in the log line...

Range-v3: An Introduction to the Library [In Spanish] -- Daniel G Vergel

This series of posts provides a brief introduction to some of the most commonly used algorithms, views, and actions of the library. It is written entirely in Spanish, in part to mitigate the lack of educational materials on modern C++ currently available in my native language. Many of the codes are nevertheless self-explanatory, and I hope, may be of interest to a broader audience.

Ranges-v3: An Introduction to the Library

 

Range-v3: An Introduction to the Library

by Daniel G Vergel

About the series

As an Associate Professor at the European University (Madrid, Spain), I decided to integrate C++17/20 and the Range-v3 library into my teaching materials to build a more interesting and up-to-date syllabus for my courses. The adoption of a functional style of coding has helped me produce better and more expressive code, making my students' first approach to system programming easier.

  1. Examples 1 (generate_n, group_by, sort, to) and 2 (filter)
  2. Examples 3 (enumerate, shuffle, take, zip) and 4 (intersperse, tokenize)
  3. Examples 5 (getlines, transform) and 6 (iota, set_difference, split_when)
  4. Example 7 (stable_partition, subrange)
  5. Example 8 (concat, drop, generate, take_while)
  6. Examples 9 (cycle) and 10 (keys, values)

 

std::format in C++20--Peter Gottschling

More convenience for formatting.

std::format in C++20

by Peter Gottschling

From the article:

Today, I'm happy to present Peter Gottschling's guest post to the new formatting library in C++20: std::format.  Thanks to std::format, text formatting becomes in C++20 as easy as in Python...

"C++ Move Semantics - The Compete Guide" is Complete and in Print -- Nicolai Josuttis

The book "C++ Move Semantics - The Complete Guide" is now done and out as ebook or printed.

C++ Move Semantics - The Complete Guide

by Nicolai Josuttis

About the book

On 260 pages (yes, it is that complicated if you want to deal with all the details), Nicolai Josuttis introduces and explains all aspects of C++ move semantics:

  • Intuitive motivation
  • Compelling examples
  • Tricky details

The book covers all aspects of move semantics:

  • From std::move() and rvalue references
  • Over reference qualifiers, invalid moved-from states, and value categories
  • Up to tricky details in generic code using std::forward(), universal/forwarding references, auto&&, and decltype(auto).

Additional chapters about move-only types and the support of move semantics in the C++ standard library help to understand and use standard types in practice.

See cppmove.com for a detailed list of all topics covered.

 

Adding ask me anything to Meeting C++ 2020

Some news about this years Meeting C++ conference: we'll have 2 AMAs!

Adding ask me anything to Meeting C++ 2020

by Jens Weller

From the article:

Some news on Meeting C++ 2020! Attendees will be able to attend AMA sessions with...

During CppCon I noticed how well AMA sessions went and that they are a great feature for an online conference. And for some time I knew that this years conference has some extra space for content due to its online nature.

std::exchange Patterns: Fast, Safe, Expressive, and Probably Underused--Ben Deane

Do you know about it?

std::exchange Patterns: Fast, Safe, Expressive, and Probably Underused

by Ben Deane

From the article:

This blog post has been a long time in the making. I gave a lightning talk on std::exchange at CppCon 2017; Jonathan first asked me to write something about std::exchange in January 2019; now here we are in the strange days of the second half of 2020. But although much has changed in the outside world, I would guess that not much has changed in most C++ codebases and in the minds of many C++ programmers with respect to using std::exchange. It could still do with more publicity and more recognition of potential use cases...