Hello,
I need help to solve the problem in my app that uses structs.
I have for example this struct:
struct SimpleStruct
{
SimpleStruct():
hasVars(false){}
~SimpleStruct();
AnotherStruct SimpleVariable;
bool hasVars;
};
and in the code, initializing this struct goes ok, but when the class, that has this struct as a variable like:
class SimpleClass
{
public:
SimpleClass();
~SimpleClass();
private:
SimpleStruct mStruct;
};
set this variable with memcpy(&mStruct,mSource,sizeof(SimpleStruct)) (mSource is the source, created somewhere else) and this class is going to be destroyed, it raises exception like this:
Unhandled exception at 0x10c4ee64 in SampleApplication.exe: 0xC0000005: Access violation reading location 0xfeeeff22.
But when I don't set this mStruct variable with new one, nothing happens and the application exits successfuly. So my questions are:
1. How can I set the struct variable (I tried mStruct = mSource and memcpy(...))
2. Why is this happening