2000-09-20 14:28:36 -04:00
|
|
|
// Build don't link:
|
|
|
|
// Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
struct IDENT
|
|
|
|
{
|
|
|
|
enum TYPE { Variable, Constant } type;
|
|
|
|
|
2000-09-25 18:06:30 -04:00
|
|
|
std::ostream& printTo(std::ostream& out) const
|
2000-09-20 14:28:36 -04:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case Variable:
|
|
|
|
out << '_';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
struct TC
|
|
|
|
{
|
|
|
|
IDENT i;
|
|
|
|
|
|
|
|
const IDENT& getIdent() const
|
|
|
|
{
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class T>
|
2000-09-25 18:06:30 -04:00
|
|
|
inline std::ostream& operator<< (std::ostream& out, const TC<T> &c)
|
2000-09-20 14:28:36 -04:00
|
|
|
{
|
|
|
|
c.getIdent().printTo(out);
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
void foo(const TC<IDENT> &c)
|
|
|
|
{
|
2000-09-25 18:06:30 -04:00
|
|
|
std::cerr << c
|
2000-09-20 14:28:36 -04:00
|
|
|
<< ": " // This line is crucial!
|
|
|
|
<< c
|
2000-09-25 18:06:30 -04:00
|
|
|
<< std::endl;
|
2000-09-20 14:28:36 -04:00
|
|
|
}
|