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. C / C++ / MFC
  4. VC++ Template problem

VC++ Template problem

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++wpfhelp
6 Posts 2 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.
  • T Offline
    T Offline
    tom76
    wrote on last edited by
    #1

    VC++ 6.0 has a problem with templates I'm told. what is it? Obseve everything, remember more...

    C 1 Reply Last reply
    0
    • T tom76

      VC++ 6.0 has a problem with templates I'm told. what is it? Obseve everything, remember more...

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      It does not support partial template specialisation, which in particular, means you cannot do the sort of template metaprogramming which has become trendy since the 'Modern C++ Design' book came out. While it is a pain, ( and still not fixed in VC7, yet ), it really doesn't stop 95% of the dev work likely to happen using templates. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

      T 1 Reply Last reply
      0
      • C Christian Graus

        It does not support partial template specialisation, which in particular, means you cannot do the sort of template metaprogramming which has become trendy since the 'Modern C++ Design' book came out. While it is a pain, ( and still not fixed in VC7, yet ), it really doesn't stop 95% of the dev work likely to happen using templates. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

        T Offline
        T Offline
        tom76
        wrote on last edited by
        #3

        Thanks. I ask because with the free compiler DEV-C++ I had a very very basic swap function, and the code would not compile under VC++ when copied in to it. Obseve everything, remember more...

        C 1 Reply Last reply
        0
        • T tom76

          Thanks. I ask because with the free compiler DEV-C++ I had a very very basic swap function, and the code would not compile under VC++ when copied in to it. Obseve everything, remember more...

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Shouldn't be a proble. The best approach would be to post the code, so we can comment. Remember to tick the box under this main edit box that says 'display this message as-is (no HTML)', or anything between <> will be lost. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

          T 1 Reply Last reply
          0
          • C Christian Graus

            Shouldn't be a proble. The best approach would be to post the code, so we can comment. Remember to tick the box under this main edit box that says 'display this message as-is (no HTML)', or anything between <> will be lost. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

            T Offline
            T Offline
            tom76
            wrote on last edited by
            #5

            lol sorry I meant I had the code - ages ago. oh! it's still on my wall... template int Temp1(X &A, X &B) { X Var; Var = A + B; return Var; } Obseve everything, remember more...

            C 1 Reply Last reply
            0
            • T tom76

              lol sorry I meant I had the code - ages ago. oh! it's still on my wall... template int Temp1(X &A, X &B) { X Var; Var = A + B; return Var; } Obseve everything, remember more...

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Oh, I thought you were trying to do a swap. This is an add, and I'm not sure it has any value over simply adding without the function call. It will not compile if the type in question does not have an operator +. Because your return type is 'int' it also will not compile unless the template argument is a number, and it will give warnings because it will strip floating point numbers down to an int. Swap would look like this ( except you'd add the template arguments being stripped by the site because neither of us checked 'show message as-is' ) template void Temp1(X &A, X &B) { X Var; Var = A; B = A; A = Var; } Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

              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