Re: STL set inside inside a class
Re: STL set inside inside a class
- Subject: Re: STL set inside inside a class
- From: Steve Checkoway <email@hidden>
- Date: Wed, 17 May 2006 16:43:04 -0700
On May 17, 2006, at 4:10 PM, Jan Brittenson wrote:
Paul Forgey wrote:
That means depthCount[depth]++ will always do what you expect
since the default instantiation of a simple scaler type is 0.
This is only true for statics.
Most likely in the OP's case, the container has never had its
constructor called. I've had
obscure bugs in the past (mainly on Linux) where g++ intermittently
won't call an inline
constructor. So if the OP has something like GenericTree() { } in
the header file, I'd either
take it out or move it to an implementation file. Otherwise it's
probably a 0 pointer
dereference, or an uninitialized pointer (pointers don't get set to
0 either unless static). If
the object is static, then its initializer may not have been called
yet while some other static
object's initializer wants to call it; in this case review the link
order, or the order in which
the static objects appear if they're in the same file.
That's not true. What Paul was saying was that operator[] calls
insert with the default value of the data type which in the case of
simple scalar times sets the value to zero. Therefore depthCount
[depth]++ will increment it to 1. There is no static issue here.
- Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden