From 8cd14415c5acca3e52dc4e26bbe4e92cb23dfbbb Mon Sep 17 00:00:00 2001 From: maazl Date: Tue, 31 Aug 2021 10:45:26 +0200 Subject: [PATCH] Better C++ support --- api/fftw3.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/api/fftw3.h b/api/fftw3.h index 65f8b897b..a47705212 100644 --- a/api/fftw3.h +++ b/api/fftw3.h @@ -50,16 +50,22 @@ #include #ifdef __cplusplus +# if __cplusplus >= 201103L && defined(FFTW_cpp_complex) +# include +# define FFTW_DEFINE_COMPLEX(R, C) typedef ::std::complex C +# endif extern "C" { #endif /* __cplusplus */ +#ifndef FFTW_DEFINE_COMPLEX /* If is included, use the C99 complex type. Otherwise define a type bit-compatible with C99 complex */ -#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I) -# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C -#else -# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2] +# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I) +# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C +# else +# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2] +# endif #endif #define FFTW_CONCAT(prefix, name) prefix ## name