mlse
06-14-2007, 11:22 AM
Hi all,
I am trying to find out exactly what endl actually is.
The C++ documentation that I have found just nonchalantly throws it in as "Oh, this is what you use for a newline character", but it doesn't explain what it actually IS.
I have tried cout << typeid(endl).name() << endl; but, maddeningly, the compiler doesn't like that! So it would seem that I can't find anything that tells me what it is and I can't write a program to find out what it is!!!
:mad: :mad: :mad:
For the moment I am using my own function macro to define endl, which explicitly checks the operating system and substitutes the appropriate const char array (either "\n" or "\r\n"). (not ideal because it's partially compiler-dependent, but at least I know what my endl actually is!).
I am asking this question because iostream's endl is causing problems for an overloaded version of the << inserter for a class that I have written which is derived from the stringstream class - if I use my version of endl then the problem goes away.
TIA,
Mike.
I am trying to find out exactly what endl actually is.
The C++ documentation that I have found just nonchalantly throws it in as "Oh, this is what you use for a newline character", but it doesn't explain what it actually IS.
I have tried cout << typeid(endl).name() << endl; but, maddeningly, the compiler doesn't like that! So it would seem that I can't find anything that tells me what it is and I can't write a program to find out what it is!!!
:mad: :mad: :mad:
For the moment I am using my own function macro to define endl, which explicitly checks the operating system and substitutes the appropriate const char array (either "\n" or "\r\n"). (not ideal because it's partially compiler-dependent, but at least I know what my endl actually is!).
I am asking this question because iostream's endl is causing problems for an overloaded version of the << inserter for a class that I have written which is derived from the stringstream class - if I use my version of endl then the problem goes away.
TIA,
Mike.