MRtrix3 / mrtrix3

MRtrix3 provides a set of tools to perform various advanced diffusion MRI analyses, including constrained spherical deconvolution (CSD), probabilistic tractography, track-density imaging, and apparent fibre density
http://www.mrtrix.org
Mozilla Public License 2.0
294 stars 181 forks source link

Fix compilation errors with C++20 #2940

Open daljit46 opened 4 months ago

daljit46 commented 4 months ago

PerThread and Shared classes in threaded_loop.h now longer use references as data members, but instead they use pointers. This fixes some errors when compiling with C++20 as the minimum standard (due to errors in initialising the variables in the constructors) and also allows us to avoid following the rule of 5 (e.g. no need to define custom copy/move constructors and assignment operators). More generally, I think we should try to avoid using references as data members of classes because they limit the implementation of a class and also slightly hurt readability (for example, it's not obvious when accessing the member that it is a reference).