Boost logo

Boost :

From: bill_kempf (williamkempf_at_[hidden])
Date: 2002-02-20 11:55:00

--- In boost_at_y..., "bill_kempf" <williamkempf_at_h...> wrote:
> > > foo[2] foos = { [10, 'a'], [20, 'b'] };
> >
> > How about:
> >
> > foo foos[2] = { foo(10, 'a'), foo(20, 'b') };
> Sorry, quite true. I was trying to generalize a different problem
> and made a horrific mistake in doing so. What I was trying to
> illustrate was a simple concept for object literals, but object
> literals aren't needed in this case.

To try and recover some from my emberassment at this stream of
thought mistake ;).

I was brain storming about a suggestion on the C++ relfector (very)
recently about object literals. I've had need for them in the past,
but the only example that easily comes to mind was in constructing a
vector statically, and to simplify things in my post here I just
switched to arrays. Sticking with vectors I'd like something along
the lines of:

vector<int> foo({1, 2, 3, 4}, 4);

Though the size parameter would be nice to eliminate as well. The
problem with this example, though, is it shows a solution using
something other then object literals and still doesn't illustrate the
need. Unfortunately I'm having trouble recalling the few times I
would have liked to have object literals that didn't involve
something like the above, and honestly with out recalling that the
syntax I provided could well not serve any way.

So, I'll just cower in my corner now ;).

Bill Kempf

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