Project

General

Profile

Actions

Bug #2966

closed

Move constructors and assignment operators should be declared noexcept

Added by Davide Pesavento almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Utils
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
1.00 h

Description

While looking at some code I noticed that we have move constructors that are not declared noexcept, which in general is a bad thing.

From a quick search in ndn-cxx I've found:

src/util/signal-scoped-connection.hpp:   ScopedConnection(ScopedConnection&& other);
src/util/scheduler-scoped-event-id.hpp:  ScopedEventId(ScopedEventId&& other);

There might be more.


From 12.5.4 Declare noexcept the move constructor and move assignment operator:

If the move constructor for an element type in a container is not noexcept then the container will use the copy constructor rather than the move constructor.

This loses most benefits of defining move constructor and move assignment operator.

Actions

Also available in: Atom PDF