#include <iostream>
#include <type_traits>

void foo(void* p) { std::cout << "foo() called. it better not try to modify *p!\n"; }

template<typename T>
void Remove (T *p)
{
    foo( const_cast< typename std::remove_const<T>::type *> (p) );
}

int main()
{
    const int *p;
    Remove(p);
}
