Project

General

Profile

Bug #2966

Updated by Alex Afanasyev almost 9 years ago

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](http://www.codingstandard.com/rule/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.

Back