Articles & Books

Friendly reminder to mark your move constructors noexcept -- AndyG

AndyG warns us that if you're upgrading to Visual Studio 2017, you might be incurring some unexpected performance overhead thanks to better noexcept support.

Friendly reminder to mark your move constructors noexcept

by AndyG

From the article:

Since C++11 we have had the noexcept keyword, which is a promise that the function will not throw an exception (and if it does, go straight to std::terminate, do not pass go). noexcept is nice for two reasons:

  1. The compiler can optimize a little better because it doesn’t need to emit any code for unwinding a call stack in case of an exception, and
  2. It leads to incredible performance differences at runtime for std::vector (and other containers, too)

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

Better memory management.

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

by Bartlomiej Filipek

From the article:

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.

Announcing Meeting C++ online!

Meeting C++ online is a series of virtual events organized by Meeting C++ for the C++ community.

Announcing Meeting C++ online!

by Jens Weller

From the article:

This year has brought a new age, and Meeting C++ will embrace this with hosting online only events in addition to the yearly conference. Its natural addition to what Meeting C++ already offers for the C++ Community. So Meeting C++ online will be a series of different virtual events organized by Meeting C++ for the C++ community.

New Attributes with C++20--Rainer Grimm

More possibilities.

New Attributes with C++20

by Rainer Grimm

From the article:

With C++20, we got new and improved attributes such as [[nodiscard("reason")]], [[likely]], [[unlikely]], and [[no_unique_address]]. In particular, [[nodiscard("reason")]] allows it to express the intention of your interface way clearer...

The implication of const or reference member variables in C++ -- Lesley Lai

This article discusses why const or reference member variables can be problematic and the workarounds.

The implication of const or reference member variables in C++

by Lesley Lai

From the article:

I decide to write this post because the same problem raises several time by different people on Twitter and the #include <C++> discord server. There are solid reasons on why you should avoid const or reference member variables in C++...

More Lambda Features with C++20--Rainer Grimm

More lambda fun.

More Lambda Features with C++20

by Rainer Grimm

From the article:

Lambdas in C++20 can be default-constructed and support copy-assignment when they have no state. Lambdas can be used in unevaluated contexts. Additionally, they detect when you implicitly copy the this pointer. This means a significant cause of undefined-behavior with lambdas is gone...