Neil Kirk Neil Kirk - 1 year ago 106
C++ Question

Can std::remove_pointer be used to remove all indirection from pointer type?

Say that I have.. int, int*, int**, etc. Can I use std::remove_pointer or similar to get straight to type int? Thanks

Answer Source


template<typename T> struct remove_all {
    typedef T type;
template<typename T> struct remove_all<T*> {
    typedef typename remove_all<T>::type type;

std::remove_pointer itself isn't of that much use here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download