M
mrstephengross
Hi folks. I've got a weird situation--gcc doesn't like the folllowing
code snippet, but I don't know if it's correct or not. Here's the
situation:
In the global namespace, I've got a operator<< declared that will send
a vector<T> to a std:stream.
In the "outer" namespace, I've got a operator<< declared that will
send a Thing<T> to a std:stream.
In the "outer" namespace, I've got a function "foo" that tries to send
a vector<T> to a std:stream.
When I try to compile it, gcc complains that there's no match for
operator<< in the foo function's definition.
Is this correct? Why is gcc not seeing the global namespace
operator<< ?
Thanks,
--Steve ([email protected])
=== test.cpp ===
#include <iostream>
#include <vector>
template<typename T> std:stream & operator<< (std:stream & o,
const std::vector<T> & v);
namespace outer {
template<class T> class Thing { };
template<typename T> std:stream & operator<< (std:stream & o,
const Thing<T> & t);
void foo() { std::vector<double> v; std::cout << v; }
}
int main()
{
return 0;
}
=== EOF ===
code snippet, but I don't know if it's correct or not. Here's the
situation:
In the global namespace, I've got a operator<< declared that will send
a vector<T> to a std:stream.
In the "outer" namespace, I've got a operator<< declared that will
send a Thing<T> to a std:stream.
In the "outer" namespace, I've got a function "foo" that tries to send
a vector<T> to a std:stream.
When I try to compile it, gcc complains that there's no match for
operator<< in the foo function's definition.
Is this correct? Why is gcc not seeing the global namespace
operator<< ?
Thanks,
--Steve ([email protected])
=== test.cpp ===
#include <iostream>
#include <vector>
template<typename T> std:stream & operator<< (std:stream & o,
const std::vector<T> & v);
namespace outer {
template<class T> class Thing { };
template<typename T> std:stream & operator<< (std:stream & o,
const Thing<T> & t);
void foo() { std::vector<double> v; std::cout << v; }
}
int main()
{
return 0;
}
=== EOF ===