Hi,
I like to know why the compiler returns me an error if I implement
operator<< for managed types as free function.
//--------
#include <iostream>
using namespace System;
class Test
{
};
std::ostream & operator<<(std::ostream & ostr, Test)
{
return ostr;
}
ref class TestRef
{
};
std::ostream & operator<<(std::ostream & ostr, TestRef^)
{
return ostr;
}
int main()
{
}
//--------
------ Build started: Project: operator, Configuration: Debug Win32 ------
Compiling...
operator.cpp
operator.cpp(19) : error C3281: 'operator`<<'' : global operator cannot
have managed type 'TestRef ^' in signature
Build log was saved at "file://e:\Project C++ NET
2005\Prove\operator\operator\Debug\BuildLog.htm"
operator - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
//--------
Thank you very much.
Marco.
--
For direct reply change underscore to dot