V
Victor Irzak
Hello,
I have a g++-3.3.1 compiler (latest).
I can't figure the type of endl, ends, flush.
Here is my program.
It compiles with VS.NET, Intel C++ compiler, but not with g++.
If you can compile it using some other type, please post the type used.
TIA,
Victor Irzak
#include <iostream>
using namespace::std;
static void fn (
#ifdef __ICC
ostream &( *f )( ostream & )
#endif
#ifdef _WIN32
ostream &( *f )( ostream & )
#endif
#ifdef __GNUC__
#if 0
// Doesn't work
ostream &( *f )( ostream & )
#endif
#if 0
// Doesn't work
std::basic_ostream<char, std::char_traits<char> >&
(*f)(std::basic_ostream<char, std::char_traits<char> >&)
#endif
//////////// What should be here????????
#endif
) {
if (f == endl)
cout << "endl" << endl;
else if (f == flush)
cout << "flush" << endl;
else if (f == ends)
cout << "ends" << endl;
else
cout << "unknown" << endl;
}
int main() {
fn(ends);
fn(endl);
fn(flush);
return 0;
}
I have a g++-3.3.1 compiler (latest).
I can't figure the type of endl, ends, flush.
Here is my program.
It compiles with VS.NET, Intel C++ compiler, but not with g++.
If you can compile it using some other type, please post the type used.
TIA,
Victor Irzak
#include <iostream>
using namespace::std;
static void fn (
#ifdef __ICC
ostream &( *f )( ostream & )
#endif
#ifdef _WIN32
ostream &( *f )( ostream & )
#endif
#ifdef __GNUC__
#if 0
// Doesn't work
ostream &( *f )( ostream & )
#endif
#if 0
// Doesn't work
std::basic_ostream<char, std::char_traits<char> >&
(*f)(std::basic_ostream<char, std::char_traits<char> >&)
#endif
//////////// What should be here????????
#endif
) {
if (f == endl)
cout << "endl" << endl;
else if (f == flush)
cout << "flush" << endl;
else if (f == ends)
cout << "ends" << endl;
else
cout << "unknown" << endl;
}
int main() {
fn(ends);
fn(endl);
fn(flush);
return 0;
}