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