Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-08-01 14:47:49


On Thursday 01 August 2002 03:23 pm, Emily Winch wrote:
> Douglas Gregor wrote:
[snip me talking about big heterogenous containers]
> Hmmm. I think the application for these containers in Mike's paper might
> well require enough elements to make the memory used by the vast
> recursion depth of a cons-style list a serious consideration. But there
> still isn't much point debating it without concrete data about real life
> compiler problems, timing, and memory usage.

Maybe Mike has some data on this for us. They might have tried cons-style
lists.

> > Contrast this with the approach taken by Burton et al. using compile-time
> > vectors as heterogeneous value containers it's much easier to create a
> > 10,000-element heterogeneous value container, and nobody needs to extend
> > Boost.Tuples to 10,000 template parameters.
>
> If Boost.Tuple was PP'ified, nobody would need to do that.

<snickers as he considers the EDG preprocessor expanding 10,000 template
parameters>

> >>In any case, it's not the case that a requirement for a certain
> >>implementation of a heterogenous value container implies a requirement
> >>for a type container with the same implementation.
> >
> > Isn't that tantamount to saying that there is no reason to manipulate the
> > types of a heterogeneous container as a metaprogram? That says that we'd
> > never want to search for a particular type in a compile-time vector?
>
> I'm not quite sure how your conclusion follows from my premise. You
> don't need a typelist implementation _at all_ to search for a type in a
> compile-time vector.

I'll try to explain my interpretation. You said:
  "In any case, it's not the case that a requirement for a certain
    implementation of a heterogenous value container implies a requirement
    or a type container with the same implementation."

To paraphrase: the need for a specific implementation of a heterogeneous value
container does not imply the need for a type container with the same
implementation. So, say we need the type vector that Burton et al. used for a
heterogeneous value container; why don't we need to access all of the types
in the container?

> // I have answered my own question, in actually trying to write this
> // out!
>
> // check that the remove_if did what we intended
> for_each<my_tuple>(print(std::cout)); // print the types
>
> // get on with the rest of the program
> for_each(my_tuple, print(std::cout)); // value algorithm
>
> Of course the compiler will do that all for us with no problem.

Good answer!

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk