This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Problem with "<<" operator
- To: gcc at gcc dot gnu dot org
- Subject: Problem with "<<" operator
- From: Pascal Francq <pfrancq at ulb dot ac dot be>
- Date: Fri, 25 Aug 2000 17:31:58 +0200
- Organization: Universit�Libre de Bruxelles
Hi,
I have a little problem with a class and the << operator:
// MyClass.h
class MyClass
{
.....
public:
MyClass& operator<<(bool b);
};
extern "C++"
{
extern MyClass& dummy(MyClass &myclass);
}
// MyClass.cpp
MyClass& operator<<(bool b)
{
// Do something
return(*this);
}
MyClass& dummy(MyClass &myclass)
{
myclass.AFunction();
return(myclass);
}
// Main.cpp
int main()
{
MyClass mc;
mc<<dummy;
}
The problem is that when I execute the code, the compiler generate a call to
the operator<<(bool) and doesn't execute the code in the dummy function.
--
Ir. Pascal Francq
Researcher
Université Libre de Bruxelles
Faculty of Applied Mechanics
Avenue F.D. Roosevelt, 50
CP 165/41
B-1050 Brussels
BELGIUM
Tel. +32-2-650 47 65
Fax +32-2-650 27 10