Objective C++ copying a struct

21 Views Asked by At

The code is super simple:

SomeStruct varA = varB;

where SomeStruct is

{
  NSString * name;
  NSDictionary<NSString *, id> *_Nullable dict;
}

When I look at my code in debug mode at exact that step, I see the name being correctly set to point at the name object in varA (and when I expand it up it has the right string value too) but the dictionary is null in varB with <error: parent is NULL>. What did I do wrong?

I actually tried

  varB.dict = [NSMutableDictionary new];
  varB.dict = varA.dict;

But that did nothing either, varB in debug mode still showed 0x0000 (ie, null) in the field dict, and when I click on it still said error is parent is NULL

0

There are 0 best solutions below