Commit bb1d6df
committed
Make Node move constructor and assignment operator noexcept (#809)
Move constructor:
* m_isValid (bool) exchange(rhs.m_isValid, true)
* m_invalidKey (std::string) std::move()
* m_pMemory (shared_memory_holder) std::move()
* m_pNode (node*) exchange(rhs.m_pNode, nullptr)
This leaves the moved-from Node as if it was just default constructed.
Move assignment:
A temporary Node is move constructed (using the above) leaving the moved-from
Node as if it was just default constructed.
*this then copy assigns the temporary, using AssignNode() directly to avoid a
second self-assignment check.
If an exception is thrown in AssignNode(), m_isValid is set to false.
Signed-off-by: Ted Lyngmo <ted@lyncon.se>1 parent c946011 commit bb1d6df
2 files changed
+60
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
17 | 26 | | |
18 | 27 | | |
19 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
20 | 44 | | |
21 | 45 | | |
22 | 46 | | |
| |||
44 | 68 | | |
45 | 69 | | |
46 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
47 | 78 | | |
48 | 79 | | |
49 | 80 | | |
| |||
209 | 240 | | |
210 | 241 | | |
211 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
212 | 256 | | |
213 | 257 | | |
214 | 258 | | |
| |||
424 | 468 | | |
425 | 469 | | |
426 | 470 | | |
| 471 | + | |
| 472 | + | |
427 | 473 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
| |||
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
44 | | - | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
| 58 | + | |
50 | 59 | | |
51 | 60 | | |
52 | 61 | | |
| |||
81 | 90 | | |
82 | 91 | | |
83 | 92 | | |
| 93 | + | |
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
| |||
145 | 155 | | |
146 | 156 | | |
147 | 157 | | |
| 158 | + | |
| 159 | + | |
148 | 160 | | |
0 commit comments