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. Conversion of C++ templates into C code

Conversion of C++ templates into C code

Scheduled Pinned Locked Moved ATL / WTL / STL
tutorialc++wpf
4 Posts 4 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.
  • A Offline
    A Offline
    Arun Chakaravarthy
    wrote on last edited by
    #1

    Hi Friends, I am using some open source code which is in C++ language. But i have to convert it to C code. In the C++ source, there are many class templates. I want to convert to the templates to C code. I don't know how to do it. Please guide me. With Thanks and Regards, Arun AC

    C T 2 Replies Last reply
    0
    • A Arun Chakaravarthy

      Hi Friends, I am using some open source code which is in C++ language. But i have to convert it to C code. In the C++ source, there are many class templates. I want to convert to the templates to C code. I don't know how to do it. Please guide me. With Thanks and Regards, Arun AC

      C Offline
      C Offline
      CP Visitor
      wrote on last edited by
      #2

      Arun Chakaravarthy wrote: I am using some open source code which is in C++ language. But i have to convert it to C code. In the C++ source, there are many class templates. I want to convert to the templates to C code. I don't know how to do it. Convert the templates to macros (templates and macros are very similar in C++).

      J 1 Reply Last reply
      0
      • A Arun Chakaravarthy

        Hi Friends, I am using some open source code which is in C++ language. But i have to convert it to C code. In the C++ source, there are many class templates. I want to convert to the templates to C code. I don't know how to do it. Please guide me. With Thanks and Regards, Arun AC

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

        it won't be possible directly, since templates are pure C++. but you could write the specialized classes with the types you'll have to use in... let's take an easy example... in C++, we have a class called map<Key, Value> well, if you use it only for (key, Value) of types (char, int), you can rewrite the part of the map<char, int> which will work only on those types... (i conceed, it's a lot of work)


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        1 Reply Last reply
        0
        • C CP Visitor

          Arun Chakaravarthy wrote: I am using some open source code which is in C++ language. But i have to convert it to C code. In the C++ source, there are many class templates. I want to convert to the templates to C code. I don't know how to do it. Convert the templates to macros (templates and macros are very similar in C++).

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #4

          CP Visitor wrote: Convert the templates to macros (templates and macros are very similar in C++). That may not always be possible. Especially if the existing code is using type expressions. Good music: In my rosary[^]

          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