This is the mail archive of the gcc-help@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]
Other format: [Raw text]

smanip<int> problem (fwd)


Hello gcc-help members

I have a small program which I get compiled using gcc version 2.95.3
20010315 (SuSE) without problems. I doesn't compile for a newer version,
namely gcc version 3.3 20030226 (prerelease) (SuSE Linux). The small
program reads as follows:

#include<iomanip>
#include<iostream>

class myostream
{
  std::ostream &out;
  int mode;

public:
  myostream(std::ostream &outi, int m = 1): out(outi), mode(m)
  {
    if (mode == 1)
      out <<'@';
    if (mode == 2)
      mode=1;
  }

  myostream &operator<<(double d){
    out << d;
    return *this;
  }

  myostream &operator<<( std::smanip<int> );

};

myostream &myostream::operator<<( std::smanip<int> s)
{
  out << s;
  return *this;
}

int main(int argc, char *argv[])
{


  myostream myout(std::cout,1);
  double f = 5.675566;
  myout << std::setw(18) << f ;

  return 0;
}

Attached is the *.ii file and the output I got after compiling this small
program (let's call it test.C) with the following command:

g++ -v -save-temps -Wall  -o test test.C

Sorry for the bad way I posted this problem. I haven't done that before.

Best regards
Kevin Brinkmann

------------------------------------------------------------------
Kevin Brinkmann                   Phone:    +49 551 39 5038
				  	    +49 551 39 5036
Institut für Materialphysik
Tammannstraße 1                   Fax:      +49 551 39 5012
37077 Göttingen / Germany         E-Mail:   kbrinkm@ump.gwdg.de
------------------------------------------------------------------

Attachment: test.ii.gz
Description: application/gunzip

Attachment: test.out
Description: Text document


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