Tag Archives: friend

Friends of Template Classes

A problem that I have been struggling with for some days. When I declare a template function as a friend of a template class, I'll get a compile error, such as the following: And I'll get a compile error message: undefined reference to 'operator< <(std::ostream&, test const&)' Finally, I found that we couldn't declare a friend function like that, we need to specify a different template type for it.

Continue Reading
Contact Us
  • Tencent AI Lab, Shenzhen, China
  • cshzxie [at] gmail [dot] com