Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-12-23 21:18:57

Larry Evans wrote:
> On 12/23/2004 11:16 AM, David Abrahams wrote:
> [snip]
>> 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?

Yes, at compile-time.

> If so, then I don't understand why:
> r.factor<TypeMap,Index>::my_field
> where r is the tuple and Index is the field number (or the superclass
> number), is not O(1) access. Could you explain why?

I have never seen a tuple type with a nested factor template, so no, I
guess I can't.

> 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.

I guess you're assuming I've looked at your code again ;-)

Dave Abrahams
Boost Consulting

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