I have a template that I would like to conditionally compile depending on the type of the argument. I only care about differentiating between "Plain Old Data" (POD), i.e., integers, etc or classes/structs. I'm using c++ VS2008 on Windows.
template<T>
class foo
{
void bar(T do_something){
#if IS_POD<T>
do something for simple types
#else
do something for classes/structs
#endif
}}
I've been looking at the boost library's and I can see that they appear to have what I want. However, I do not understand what the correct syntax for the #if
statement would be.
Any help would be appreciated.
Edit ---
After reading the responses, I see I overlooked something in my definition of the question. Class foo
is a templated class that only needs to instance the version of bar
that is correct for class type T
. I was looking for a solution that can be resolved a compile time. Hope this clears up my problem.