error C2440: 'type cast' : cannot convert from 'std::stringstream' to 'void *'

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello,

I don't understand why I cannot do the following with vs7:

-----------------------------------
#include <iostream>
#include <sstream>

int main ()
{
std::stringstream ss;
if ( (void*)ss == 0) {
std::cerr << "zero\n";
}
return 0;
}
-----------------------------------

The compiler is returning:

ss.cxx(7) : error C2440: 'type cast' : cannot convert from
'std::stringstream' to 'void *'
Ambiguous user-defined-conversion

But stringstream should inherit this from its parent ios, right ?

http://cplusplus.com/ref/iostream/ios/operatorvoidpt.html

Thanks
Mathieu

.



Relevant Pages

  • Re: It Pays to Enrich Your C Skills
    ... Check if you can score a perfect 10 (without using a compiler). ... int main{ ... struct bitfield { ... out if it is a negative integer constant or a constant expression ...
    (comp.lang.c.moderated)
  • OT: Re: Perl Peeves
    ... I see the result of a test being used as an int. ... the compiler just assumed you knew what you were doing ... introduced to the language later, so void * was unheard of in most code. ... This didn't mean bool was special, declaring it just signaled to the ...
    (comp.lang.perl.misc)
  • Re: OT: Re: Perl Peeves
    ... when I see the result of a test being used as an int. ... compiler just assumed you knew what you were doing and would ... This didn't mean bool was special, declaring it just signaled to the ... What "normalization of bool results is built into the compiler"? ...
    (comp.lang.perl.misc)
  • Re: [CodeGallery] MFC MD5 Calculator
    ... Then when they added types, internally, the compiler still thought they were int values, ... ANSI standard began to emerge that the language design ...
    (microsoft.public.vc.mfc)
  • Re: cpu type idea
    ... compiler related recently. ... int main ... float a; ... just to parallelize the vectror and tensor operations. ...
    (alt.lang.asm)