Articles & Books

"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...

CppCon 2020 Trip Report--Conor Hoekstra

And another.

CppCon 2020 Trip Report

by Conor Hoekstra

From the article:

This was my second time attending CppCon. The first time I attended was in 2019, when I gave my first CppCon presentation in two parts, Algorithm Intuition - although I personally recommend the C++Now 2019 version which is 30 minutes shorter.

CppCon 2020 Trip Report--Shafik Yaghmour

And another.

CppCon 2020 Trip Report

by Shafik Yaghmour

From the article:

CppCon 2020 was online this year due to Covid-19. I was not sure what to expect from an online only conference. I had heard mildly positive feedback from recent online only conferences but this would be my first experience. For the most part the experience exceeded my expectations. There were were technical problems here and there but mostly it ran smoothly. It was fatiguing to watching videos for so long but since I was home I was able to stretch in between sessions and move around and that usually helped...

The last vestiges of object oriented programming -- Geoffrey Viola

A history, some negative examples, and some positive examples of using object oriented programming in C++.

The Last Vestiges of Object Orientated Programming

by Geoffrey Viola

From the article:

Object oriented programming is not as popular as it was. As with any programming language feature it can be abused. Multiple inheritance, long inheritance chains, and needless inheritance can add unnecessary complexity. There are few cases where it works well in C++: building product types, enforcing an invariant, and dynamic polymorphism. Generally, classes should follow one of these deliberately to follow the single responsibility principle, but there are exceptions.

Introduction to modern CMake for beginners

A look at one of the most popular build systems for C and C++.

Introduction to modern CMake for beginners

Internal Pointers

From the article:

CMake is a collection of open-source and cross-platform tools used to build and distribute software. In recent years it has become a de-facto standard for C and C++ applications, so the time has come for a lightweight introductory article on the subject.

Quick Q: Is std::unique_ptr required to know the full definition of T?

Quick A: For certain members only.

Recently on SO:

Is std::unique_ptr<T> required to know the full definition of T?

Most templates in the C++ standard library require that they be instantiated with complete types. However shared_ptr and unique_ptr are partial exceptions. Some, but not all of their members can be instantiated with incomplete types. The motivation for this is to support idioms such as pimpl using smart pointers, and without risking undefined behavior...