Monthly Archives: November 2012

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
  • Nanyang Technological University, Singapore
  • root [at] haozhexie [dot] com