intelligent way to copy structs??

 

I define a struct:

struct TradeSet {
        double IniTgt, IniStp, PTS, PIP;
        string Symb, Descr, Full;
        int Magic, DIG, BuTckt, SeTckt; 
};

Now I just want to copy (move within the list) one element :

TradeSet arr[];
...
TradeSet tmp;
tmp = arr[i];
...
arr[j] = tmp

But the compiler complains:

'=' - structure have objects and cannot be copied       myEA_v2.mq4     360     7
'=' - structure have objects and cannot be copied       myEA_v2.mq4     366    10

So is there a more intelligent way to copy a struct that to write my own function that copies each single element one by one?

Gooly

 

I think the issue is the inclusion of the strings in your struct definition.

(From the documentation: Structures and Classes):

Simple Structures

Structures that do not contain strings or objects of dynamic arrays are called simple structures; variables of such structures can be freely copied to each other, even if they are different structures. Variables of simple structures, as well as their array can be passed as parameters to functions imported from DLL.

.

Reason: