Considering the following code:
class MyClass
{
...
};
template
class List
{
public:
void insert(const Object & x)
void insert(const Object & x)
{
M_insert(x, dispatcher::value> );
}
Inside List
use a dispatcher
template class dispatcher {};
using ObjectPtr = dispatcher;
using ObjectValue = dispatcher;
then dispatch to M_insert
:
void M_insert(const Object &p, ObjectPtr) { // Object is a pointer }
void M_insert(const Object &p, ObjectValue) { // Object is not a pointer }
Live example here. But, I'd encourage you to determine whether you really need that and possibly fix your design accordingly.