This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [offtopic] STL complex design question


nbecker@fred.net wrote:
> 
> I do a lot of numerical computation.  I like to use the complex<>
> class.  The STL specifies a default constructor, which will set a
> complex element to zero.  This means that anytime a large complex
> array is needed (for example, enters local scope), the whole thing
> will always be zeroed.
> 
> In my opinion, this is a bad idea.  It's potentially a waste of CPU
> time, and as far as I know there's no good way to avoid it.
> 
> Any thoughts?

Have an array of pointers to complex instead of an array of complex --
automatic constructor calls are one of the things I hate most about C++.

Noel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]