Is there a way to instantiate C++ template as C code?

I am targeting OpenCL and forced to write code in C, so am really missing C++ templates. Currently doing string substitution on C sources when sending code to OpenCL compiler which is error-prone.
In general, my question is how to generate C code from C++?, but out of C++ I mostly need just template instantiation feature. Polymorphism isn’t needed, though inheritance and auto would be nice, but not as important as templates, which begs being easy to steal from g++ functionality or something.

Source: Windows Questions C++

LEAVE A COMMENT