Is it possible to use memset to populate the std :: complex <float> s array?

In particular, I am wondering if this line is:

memset(cjzyp,(0,0),size_cjzy*sizeof(std::complex<float>)); 

populate cjzyp , an array of complex<float> s, with a complex null value ( (0,0) ).

+4
source share
1 answer

std::memset takes int as the second parameter, converted to unsigned char, it will not work. Use std::fill instead

http://www.cplusplus.com/reference/algorithm/fill/

 cjzyp = new std::complex<float>[100] std::fill(cjzyp, cjzyp + 100, std::complex<float>(-1.0, 0.0)); delete [] cjzyp; 
+3
source

Source: https://habr.com/ru/post/1447642/


All Articles