Topic: deque< complex<double> >?


Author: "Andrew Skiba" <skiba@macs.biu.ac.il>
Date: 1998/08/13
Raw View
riemans@my-dejanews.com wrote:
>I'm trying to get a deque (or any container class) to work with a complex
>object. MS Visual C++ chokes on this (seemingly) simple STL example:
>#include <deque>
>#include <complex>
>using namespace std;
>typedef complex<double> CPD;
>typedef deque<CPD> DCPD;
>int main()
>{
>   DCPD foo;
>   return 0;
>}
>-------
>
>The <complex> documentation says it does but the compiler reports:
>C:\Program Files\major\DevStudio\VC\Include\xmemory(33) : error C2300:
>'std::complex<double>' : class does not have a destructor called '~_Ty'
>
>Is this a Microsoft implementation problem? If so, will this example work on
>g++ or Borland?  Thanks in advance.


My Borland C++ 5.01 compiles it with 3 warnings:

Info :Compiling W:\Work\aaa.cpp
Warn :  COMPLEX.h(1526,2):Cannot create pre-compiled header: code in header
Warn :  DEQUE.h(848,1):'n' is assigned a value that is never used
Warn :  DEQUE.h(897,1):'n' is assigned a value that is never used

I think I can ignore them.
Link was successful as well.


[ moderator's note: I'm letting this go by because the original
  question asked whether the code compiled with Borland. Let's
  keep further discussion standard-related. That is, compiler
  comparisons in this newsgroup should always be from the viewpoint
  of whether the compilers conform to the standard. -sdc ]


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: riemans@my-dejanews.com
Date: 1998/08/11
Raw View
I'm trying to get a deque (or any container class) to work with a complex
object. MS Visual C++ chokes on this (seemingly) simple STL example:

---snip---
#include <deque>
#include <complex>

using namespace std;

typedef complex<double> CPD;
typedef deque<CPD> DCPD;

int main()
{
   DCPD foo;
   return 0;
}
-------

A deque is supposed to work if the template parameter has a default ctor,
dtor, and assignment/copy.  The <complex> documentation says it does but the
compiler reports:

C:\Program Files\major\DevStudio\VC\Include\xmemory(33) : error C2300:
'std::complex<double>' : class does not have a destructor called '~_Ty'

Is this a Microsoft implementation problem? If so, will this example work on
g++ or Borland?  Thanks in advance.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: "P.J. Plauger" <pjp@dinkumware.com>
Date: 1998/08/12
Raw View
riemans@my-dejanews.com wrote in article <6qpnq2$cgk$1@nnrp1.dejanews.com>...
> A deque is supposed to work if the template parameter has a default ctor,
> dtor, and assignment/copy.  The <complex> documentation says it does but the
> compiler reports:
>
> C:\Program Files\major\DevStudio\VC\Include\xmemory(33) : error C2300:
> 'std::complex<double>' : class does not have a destructor called '~_Ty'

This is a known VC++ compiler bug that interacts with template function
_Destroy in <xmemory>. For a workaround, see:

http://www.dinkumware.com/vc_fixes.html

Note that this list of bugs was updated today, 11 August 1998.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com/hot_news.html




[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]