> Old trick.
I figured, but old tricks are new for each individual at least once... : )
And IMHO this forum could use some more voluntarily posts of tricks and
techniques in contrast to all of the how-do-I-solve-this-problem posts. In
one case solution-posters are being pro-active, in the other
passive-aggressive. I think this forum (and others) could benefit from
both... : )
> An even easier way - just cast the this pointer to an integer type and
> call that the ID. Guaranteed unique with absolutely no overhead.
Cool, but this doesn't get you the added bonus of a variable which can be
used to determine if instances ar being created. For example, I can look at
's_ID', step over a routine, and if 's_ID' has increased I know instances
have been created. There are times (like this weekend for me....lol) when I
have discovered methods that were creating and manipulating copies when I
wanted to be manipulating the originals. I stepped over the 'offending'
method, and when I saw instances being created, I knew what the problem was
and where to look for them... : )
And the 'overhead' you speak of is one long per class definition, one long
per instance, one line of code, and one single-line-of-code method (ID( )).
Not exactly what I'd call 'heavy' in this day of giga-bytes and tera-bytes
of storage.
Although, granted, your solution is both elegant and sweet... : )
[==P==]
>> Sometimes it's hard to get straight when passing or storing or
>> returning an instance of a class whether you are still dealing with
[quoted text clipped - 58 lines]
>
> -cd