I ran into this today while trying to figure out why my code was broken.
Thought I'd pass this along and hopefully save someone some wasted time in
the future...

CRefArray a1;
a1.Add(CRef());
a1.Add(CRef());
CRefArray a2(a1);
a2.Add(CRef());
LONG n1 = a1.GetCount();  // expected n1 == 2
LONG n2 = a2.GetCount();  // expected n2 == 3

I expected a2 to be a copy of a1 before the last add and so I assumed a1
would have 2 elements.
Instead, I was surprised to find that n1 == n2 == 3!

Reply via email to