That is, on disk, if I have an array std::complex, is it stored, RIRIRIRIor RRRRIIIIor something else?
std::complex
RIRIRIRI
RRRRIIII
My real question is: if I have a structure that I defined that contains two numbers, can I re-interpret to pass an array of my structure in order to use the functions that the array would expect std::complex?
What about memcpy? If both of my structures are floats, should this be normal if they are kept the same?
The C ++ class is slightly larger than structwith some decorations. Thus, the members defined in the class are ordered sequentially in memory, adjacent to each element of this type. In other words, the array std::complexwhere each element contains RIwill be saved RIRIRIRI.
struct
RI
You may succeed with reinterpret_cast, but you will be dependent on the implementation std::complexif you do this - and it will probably be just fine.
reinterpret_cast
The std :: complex array, defined as follows:
std :: complex array [COUNT];
... RIRIRIRI , [i] , [array], * ( + i). RRRRIIII, .
, IS RRRRIIII: StructuredBuffer Direct3D 11+. API, RIRIRIRI GPU, RRRRIIII, GPU, .
, .
:
ofstream file("somefile.txt"); file << complex_var.real() << "\t" << complex_var.imag() << "\n";
file << complex_var << "\n";
( ) '(realpart, imaginarypart) `. , , , , (, , ) , .
, . , . .
, , ( ). std::complex .
Source: https://habr.com/ru/post/1531142/More articles:Получить URL-адрес перенаправления после ajax GET - javascriptRectangular object pressed blue background - androidWrong practice of combining REST and RPC together? - restКак я могу обновлять данные в полях CLOB с помощью >> подготовленного запроса << с ODP (Oracle.DataAccess)? - c#How to efficiently extract real / imaginary parts of a complex matrix in the Eigen3 library? - c ++get object from memory using hash code - javaConfiguring phpspec and laravel - laravelPandas; complex pivot table - pythoncustom font does not load correctly in Chrome - htmlHow to use "User.Identity.IsAuthenticated" in the web API - c #All Articles