Commit 6c699a6
committed
COMP: Replace raw pointers with std::unique_ptr in VoxBoCUBImageIO
- Change m_Reader/m_Writer from GenericCUBFileAdaptor* to
std::unique_ptr<GenericCUBFileAdaptor>
- Change CreateReader/CreateWriter return types to std::unique_ptr;
use std::make_unique for polymorphic factory creation
- Call m_Writer.reset() at end of Write() to preserve original
close-on-write behavior (flush/close file immediately)
- Remove {} brace-initializers from unique_ptr members: GCC 7 has a
known bug (fixed in GCC 9.2) where brace-initializing a smart pointer
to a forward-declared class instantiates ~unique_ptr<T> with an
incomplete type. See ITK#3877.
- Declare ~VoxBoCUBImageIO() in the header and define it as = default
in the .cxx file where GenericCUBFileAdaptor is a complete type.
Defining = default in the header would instantiate
~unique_ptr<GenericCUBFileAdaptor> with an incomplete type, causing
undefined behavior. See https://andreasfertig.com/blog/2023/12/when-an-empty-destructor-is-required/
- Add <memory> include1 parent fdd8f7f commit 6c699a6
2 files changed
Lines changed: 21 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | | - | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | | - | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | | - | |
| 113 | + | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
378 | | - | |
| 378 | + | |
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
| 400 | + | |
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
438 | 437 | | |
439 | 438 | | |
440 | 439 | | |
| |||
468 | 467 | | |
469 | 468 | | |
470 | 469 | | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
| 470 | + | |
475 | 471 | | |
476 | 472 | | |
477 | 473 | | |
| |||
741 | 737 | | |
742 | 738 | | |
743 | 739 | | |
744 | | - | |
745 | | - | |
| 740 | + | |
746 | 741 | | |
747 | 742 | | |
748 | 743 | | |
| |||
0 commit comments