Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2002-08-28 17:36:57


----- Original Message -----
From: "Victor A. Wagner, Jr." <vawjr_at_[hidden]>

> At Tuesday 2002/08/27 15:43, you wrote:
>
> >----- Original Message -----
> >From: <spamjunk_at_[hidden]>
> >
> >
> > > I added some preliminary documentation here:
> > > http://groups.yahoo.com/group/boost/files/Set/discrete_set.html
> > > I will add to it as time permits.
> > >
> > > Rich Herrick
> >
> >If all the elements of the set are known at compile time, why
> >do you need to store the bits at all? Your class can encode
> >the information in its type, thus, your class can consume
> >zero bytes.
>
> right up until you need to add (or subtract) something that isn't knows
> until runtime.

For example, a | b where a and b are static sets does *add* into the
original set. ET generates a completely new set in this case which
is the addition of the entries of a *plus* b.

The only problem (for now) is that C++ can't deduce the type of the
RHS to apply it to a variable. If we had the "auto" type that Dave
Abrahams originally suggested and was discussed here before,
we could write:

    auto c = a | b;

Whereby making c a new type which is the union of a and b.
The typeof(T) will also work here, albeit ugly:

    typeof(a | b) c = a | b;

This is *yet* another reason why we need the "auto" type deduction
keyword. ET cries for the "auto"!

Cheers,
--Joel


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