M
mojmir
hello,
i have problem with following code (see below). compiler (vs2005sp1)
complains
that the call to fn is ambiguous:
error C2668: 'BB::fn' : ambiguous call to overloaded function
could be 'void BB::fn<dummy>(T &,BB::foo &)'
or 'void AA::fn<dummy>(T &,BB::foo &)'
okay, i have said, and tried to be more specific about the namespace
the fn<> lives in, i.e. from
template<class T> friend void fn(T &, foo &);
to
template<class T> friend void AA::fn(T &, foo &);
wow:
void AA::fn(T &,BB::foo &)' : symbol cannot be defined within
namespace 'BB'
defined? who? where? i merely declared the function to be friend, no?
best regards,
mojmir
=8<===================================================
namespace BB {
class foo;
}
namespace AA {
template<class T> void fn(T &, BB::foo &);
}
namespace BB {
class foo {
template<class T> friend void fn(T &, foo &);
};
}
namespace AA {
template<class T> void fn (T &, BB::foo &) { }
}
class dummy { };
void wmain() {
using namespace BB;
using namespace AA;
foo f;
dummy d;
fn(d, f);
}
i have problem with following code (see below). compiler (vs2005sp1)
complains
that the call to fn is ambiguous:
error C2668: 'BB::fn' : ambiguous call to overloaded function
could be 'void BB::fn<dummy>(T &,BB::foo &)'
or 'void AA::fn<dummy>(T &,BB::foo &)'
okay, i have said, and tried to be more specific about the namespace
the fn<> lives in, i.e. from
template<class T> friend void fn(T &, foo &);
to
template<class T> friend void AA::fn(T &, foo &);
wow:
void AA::fn(T &,BB::foo &)' : symbol cannot be defined within
namespace 'BB'
defined? who? where? i merely declared the function to be friend, no?
best regards,
mojmir
=8<===================================================
namespace BB {
class foo;
}
namespace AA {
template<class T> void fn(T &, BB::foo &);
}
namespace BB {
class foo {
template<class T> friend void fn(T &, foo &);
};
}
namespace AA {
template<class T> void fn (T &, BB::foo &) { }
}
class dummy { };
void wmain() {
using namespace BB;
using namespace AA;
foo f;
dummy d;
fn(d, f);
}