Код: Выделить всё
#include
// Declare plan
fftw_plan myPlan;
// Initialise plan
myPlan = fftw_plan_dft_r2c(3, m, f, reinterpret_cast(fk.get()), FFTW_PATIENT);
// Perform an FFT
fftw_execute(myPlan);
// Free the memory associated with the plan
fftw_destroy_plan(myPlan);
Однако я Я пытался настроить этот процесс с помощью интеллектуального указателя, который автоматически освобождает память, когда план выходит за рамки. Вот что у меня получилось:
Код: Выделить всё
std::unique_ptr myPlan(
fftw_plan_dft_r2c(3, m, f, reinterpret_cast(fk.get()), FFTW_PATIENT),
fftw_destroy_plan
);
Код: Выделить всё
no instance of constructor "std::unique_ptr::unique_ptr [with _Tp=fftw_plan, _Dp=void (*)(fftw_plan p)]" matches the argument listC/C++(289)
strFunc.cc(26, 9): argument types are: (fftw_plan, void (fftw_plan p))
p>
Если у кого-то есть идеи относительно того, как прогрессировать, я буду очень признателен!
Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/792 ... w3-library
Мобильная версия