Use the same piece of code without using macros for two different data types
<p>I want to use a single piece of code for two different data types without using macros. I tried something like this, but I did not come up with a complete solution.</p>

<pre><code>void func(bool istype1, void *ptr)
{
    void *t1;
    if(isType1)
        t1=static_cast&lt;type1&gt;(ptr);
    else   // isType1 == false means data type 2.
        t1=static_cast&lt;type2&gt;(ptr);

    ...
    ...
    ...
}
</code></pre>
