I am running in some strange problems when the context of an indicator is specified in a variable: the local code is correctly Works from, but it causes memory access errors elsewhere:
// It works fine Gridcell * g = model.gc; Cout & lt; & Lt; G- & gt; LC_update & lt; & Lt; "" & Lt; & Lt; G & lt; & Lt; Endl; // When I include it, the program crashes elsewhere / but output from this line is ok Gridcell gc = * g; Cout & lt; & Lt; "WAR:" & lt; & Lt; Gc.LC_updated & lt; & Lt; & Amp; GC & lt; & Lt; Endl; (Gridcel is a class in which there is no ARG constructor) I'm not a C ++ expert, and this is a large external library, but I can not understand that locally Why should the assignment for the scoppy variable cause the problem elsewhere. Can someone put some light on this?
You must ensure that gridsel is a proper copy maker only It is only necessary if gridsell manages resources manually, which should never be the case at all. If this is the case for you, then you will need it. If you need more specific help, after the definition of the category of gridcel , with consultants and district, if you have it. If you do not have intent copy, you can use the reference:
GridSell & amp; GC = * g; Cout & lt; & Lt; "WAR:" & lt; & Lt; Gc.LC_updated & lt; & Lt; & Amp; GC & lt; & Lt; Endl; Usage is similar, but it will not make a copy.
Comments
Post a Comment