A quick test gives me following result:

# VERBOSE : cRefArrayTest_Execute called
# VERBOSE : Count a1: 3
# VERBOSE : Count a2: 3


On 4/30/2012 6:24 PM, Nicolas Burtnyk wrote:
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!


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1831 / Virus Database: 2090/4557 - Release Date: 10/17/11
Internal Virus Database is out of date.

Reply via email to