Friendly reminder to mark your move constructors noexcept -- AndyG

Save to:
Instapaper Pocket Readability

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)

Add a Comment

You must sign in or register to add a comment.

Comments (0)

There are currently no comments on this entry.