Use std::shared_ptr for FFTW/IMKL FFT plan implementation; Fixes #2651
What does this implement/fix?
This MR fixes possible undefined behavior caused by the copying of FFT plan objects happening with FFTW and IMKL FFT backends, please see #2651 (closed) for details.
Additional information
I've verified the fix to work using the existing testsuite, only in the case of MKL backend I enabled the use of 'mklfft.cpp' test with the following snippet:
set(MKL_THREADING gnu_thread)
set(MKL_INTERFACE lp64)
find_package(MKL)
if(MKL_FOUND)
ei_add_test( mklfft "-DEIGEN_MKLFFT_DEFAULT" "MKL::MKL" )
endif()
I'm not merging this snippet though, as this is an ad-hoc solution which doesn't take into account all the possible complexities of integrating MKL into the build system.