I am trying to figure out how to use the Boost.Preprocessor library http://www.boost.org/doc/libs/release/libs/preprocessor to unfold a "generic" type for different specific types. Below I will ask this for a simple point class example. Given:
struct Point##TYPE_SUFFIX_NAME
{
TYPE X;
TYPE Y;
// Other code
};
I want to generate this type for different basic (POD) data types e.g.:
PointF32, PointF64, PointI32 etc.
where PointF32 would be:
struct PointF32
{
float X;
float Y;
};
That is, based on a list of types:
short, int, long, float, double etc.
I want to "unfold" the above type for these. Preferably with the "template" definition in a separate include file and not as a macro, to allow for easier debugging.
NOTE: I am not interested in hearing about C++ templates. I know how to use templates. But these are not useful in my case. As an example imagine these types are going be used from .NET in C#, but are being generated in C++/CLI. So please stick to the question.
The problem, of course, stems from the lack of template support in .NET and due to generics not being suitable to solve my problem.