Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. template class c2995 operator<< overloading [modified]

template class c2995 operator<< overloading [modified]

Scheduled Pinned Locked Moved ATL / WTL / STL
help
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    ky_rerun
    wrote on last edited by
    #1

    I have a class template class foo() { template friend ostream& operator<< (ostream& os, TestTemplateCollection& r) {... } int main(int argc, char * argv) { foo; foo**; //error c2995 operator<< allready defined } order doesn't matter both T and B work without the other is there something special you must do to friend template classes work. I do have the header in cased in a #pragma once statmen so its not in the preprocess output twice. -- modified at 22:08 Tuesday 17th April, 2007 a programmer traped in a thugs body**

    K 1 Reply Last reply
    0
    • K ky_rerun

      I have a class template class foo() { template friend ostream& operator<< (ostream& os, TestTemplateCollection& r) {... } int main(int argc, char * argv) { foo; foo**; //error c2995 operator<< allready defined } order doesn't matter both T and B work without the other is there something special you must do to friend template classes work. I do have the header in cased in a #pragma once statmen so its not in the preprocess output twice. -- modified at 22:08 Tuesday 17th April, 2007 a programmer traped in a thugs body**

      K Offline
      K Offline
      ky_rerun
      wrote on last edited by
      #2

      I fixed this. If any one wants to know friend function of template classes should be defined outside the class definition but in the header file or you liker will crap its pants.


      a programmer trapped in a thugs body

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups