[ create a new paste ] login | about

Link: http://codepad.org/0ah41cLA    [ raw code | fork ]

GManNickG - C++, pasted on Apr 20:
// in the general case, T is not a pointer
template <typename T>
struct remove_pointer
{
    typedef T type;
};

// but in this specialization, it is
template <typename T>
struct remove_pointer<T*>
{
    typedef T type;
};

int main(void)
{
    typedef int* ptr;
    typedef remove_pointer<ptr>::type val;

    val i = 2;
    ptr p = &i;
}


Output:
No errors or program output.


Create a new paste based on this one


Comments: