|
Boost : |
From: Gavin Collings (gcollings_at_[hidden])
Date: 2000-02-07 10:52:15
> No specific destruction order is necessary to pass around the
message.
> The message itself is not used until there is only one node on the
> list. So the actual node that carries it is unimportant (the circular
> list helps here). Along as one node knows the message, it is not
lost.
> If a node is leaving the list and has the message, it passes it on to
> its neighbor. The direction is irrelevant. It is true that in some
> circumstances, the message might need to be passed to evey node on the
> list, but each of these operations would be constant time. This lazy
> evaluation allows all operations to be limited to O(1).
Ah yes, quite neat. I haven't properly explored using the list as a
notification mechanism, this looks like a good application of it,
though. Shall we split the difference and say N/2 on average then ;)
I'm still a little hesitant about leaving all those potentially
dangling references around, though.
> Do you have struct alignment settings leftover from some previous
> project? MSVC's default is 8 byte alignment.
Here's what MSDN says: -
Type Alignment
--------------
char Align on byte boundaries
short (16-bit) Align on even byte boundaries
int and long (32-bit) Align on 32-bit boundaries
float Align on 32-bit boundaries
double Align on 64-bit boundaries
structures Largest alignment requirement of any member
unions Alignment requirement of the first member
The largest alignment requirement of any member is 4 bytes (pointer).
The 8 bytes you're talking of is the maximum amount of padding that
will be inserted to bring about this alignment (/Zp option). That is
set to 8 bytes in my VC project, I still get a 12 byte linked_ptr
though - apparently no padding is necessary.
Gavin.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk