Re: smanip<int> problem (fwd)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 25, 2003 at 11:32:22AM +0200, Kevin Brinkmann wrote:
> Hello gcc-help members

Hi there.
 
> 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>

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

> };

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

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

I think you've done pretty good. Most people try to describe their
problem with their own words instead of providing the facts.

> test.C:25: error: `smanip' undeclared in namespace `std'

It seems that smanip once was in the ANSI draft for the STL but it
didn't make it in and got rejected.

Actually, the manipulators defined in the `iomanip' header return some
"unspecified" type. So, you can't use them for your own class. But of
course you may define your own manipulators and "<<" operators.

HTH
-- 
Claudio Bley                                 ASCII ribbon campaign (")
Debian GNU/Linux user                         - against HTML email  X 
http://www.cs.uni-magdeburg.de/~bley/                     & vCards / \


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux