Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-03-06 15:34:50


----- Original Message -----
From: "Ralf W. Grosse-Kunstleve" <rwgk_at_[hidden]>

> > > It seems to me that this is more a question of how
> > > containers work rather than one of the design of
> > > std::complex<T>.
> >
> > There's still the issue of what happens when I write
> >
> > complex<double> *p = new complex<double>[10000];
>
> This calls complex<double>() 10000 times?
>
> What about:
> double *p = new double[10000];
>
> Does this call double() 10000 times? I guess not. I guess because
> double is a POD. Correct?

Precisely.

> > They're separate questions. I think the canonical answer to the
vector
> > issue is "use valarray instead", though I'm not certain of that.
>
> I am looking at section 22.4.1 of Stroustrup:
>
> explicit valarray(size_t n); // n elements with value T()
>
> To me it seems that std::vector and std::valarray have the
> same features (i.e. problems).

Hmm.

> I wrote:
> > This suggestion requires that type traits are part of the
> > standard. Is this likely to happen any time soon?
>
> Could you please comment?

"Soon" is a relative term. I would bet that they are in the next
standard, though.

-Dave


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