Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-12-23 15:11:16

On 12/23/2004 11:16 AM, David Abrahams wrote:
> Another is that (unless you use nonstandard language extensions) only
> flat structures allow O(1) random access.

I'm afraid I don't understand. By "access" do you mean access to
the elements in the structure? If so, then I don't understand why:


where r is the tuple and Index is the field number (or the superclass
number), is not O(1) access. Could you explain why?

BTW, if the method used in sum is slightly changed (replace max
with + when calculating max_size), then the storage can all be
moved to the most derived class and all superclasses just contain
functions; hence, the padding problem (I guess) is not longer there.
This, of course, is at the cost of a little more complicated
product::project method.

Boost list run by bdawes at, gregod at, cpdaniel at, john at