Quote:Original post by soconne
Quote:Original post by PiNtoS
If you don't want to use boost, this should work:
Hey thanks PiNtoS. That's pretty much what I was going for.
But I also like the example _goat showed using boost. Although if at all possible I'd like not to use boost. I took a look at the boost header file containing the if_ template, it doesn't make a lot of sense, but I would ultimately like something similar to that.
Don't avoid Boost. It has a ton of extremely useful functionality. Install it, and use the bits you find convenient. There's usually no reason not to.
However, in this particular case, I'd say using boost's type_traits is overkill. As shown above, it's simple enough to make a template specialization for pointers.
But seriously, "I'd like not to use boost" is just silly. You might as well say you'd rather avoid functions, or loops. C++ without boost is just silly. [grin]
It's one of the few things that make C++ bearable.