0

Check whether class has noexcept move constructor or not

Hi I think STL works efficiently with our custom class if it has noexcept move constructor.. we can check using static assert that class has move constructor as noexcept or not. Refer code below: Is it really checking the same? I dont think so. 1. test has destructor defined and hence we dont have move by compiler so it is not noexcept. Isn't it? but static assert does not check this..! how to catch ? 2. test has copy assignment defined and hence we dont have move by compiler so it is not noexcept. Isn't it? but static assert does not check this..! how to catch ? Making copy constructor user defined catches that class is not a movable as noexcept. Can we check all this by some means and be assured that class is really a noexcept movable? https://code.sololearn.com/ctvZ0k90EElk/?ref=app

10th Dec 2022, 6:17 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Resposta
0
From my understanding you telll the compiler which functions are to be noexcept So i would guess that the programmer would have to assure themselves
18th Dec 2022, 8:32 AM
Raul Ramirez
Raul Ramirez - avatar