Hello,
I have about 1-50 mb data in memory and for access/analysis I need fast access to this memory.
I have to inserts my Array of structs (sometimes 60 double pairs) in the large Array, move memory
around and so on.
Because we've no memcpy I like to use ArrayCopy but I can't get a working cast.
So I'm looking for a way to cast my struct to any position inside the large double Array.
Thanks for helping.
a double value is not going to be able to contain a structure of two doubles it won't fit no matter how you cast it
Thanks for your answer. A double struct has 16 Bytes and I can't copy the content to a dynamic array of doubles with ArrayCopy?
Thanks for your answer. A double struct has 16 Bytes and I can't copy the content to a dynamic array of doubles with ArrayCopy?
ArrayCopy needs a source array and a destination array, your structure is not an array.
what are you really trying to achieve? how does moving the values from structure to a double array make it any faster access?
Hello,
I have about 1-50 mb data in memory and for access/analysis I need fast access to this memory.
I have to inserts my Array of structs (sometimes 60 double pairs) in the large Array, move memory
around and so on.
Because we've no memcpy I like to use ArrayCopy but I can't get a working cast.
So I'm looking for a way to cast my struct to any position inside the large double Array.
Thanks for helping.
You could do this:
struct stMyStruct { double dblD[]; }; int OnInit() { stMyStruct mySt; ArrayResize(mySt.dblD, 2); mySt.dblD[0] = 0.3; mySt.dblD[1] = 9.67; double dblMem[]; ArrayResize(dblMem, 4); ArrayCopy(dblMem, mySt.dblD, 0, 0, 2); ArrayPrint(dblMem); // 0.30000 9.67000 +0.00000 +0.00000
You could do this:
The structure is delivered from MT5 and I have to deal with it. Normally I could deal direct with these data but
I need no remove some elements (build a new struct) and then store them in memory for access.
lippmaje: yes, I know. But thanks
Laszlo Tormasi: oh, I did not know that. This is a very good point and could solve my problem. Thanks.
StructToCharArray is not really what I want because I copies the Elements to the struct.
I should have known that right away. A cast would only give me access in form of the struct
without cpu cycles or memory movement.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I have about 1-50 mb data in memory and for access/analysis I need fast access to this memory.
I have to inserts my Array of structs (sometimes 60 double pairs) in the large Array, move memory
around and so on.
Because we've no memcpy I like to use ArrayCopy but I can't get a working cast.
So I'm looking for a way to cast my struct to any position inside the large double Array.
Thanks for helping.