Generic pointers

suggest change

The criteria that a type must satisfy in order to support pointers (see Remarks) cannot be expressed in terms of generic constraints. Therefore, any attempt to declare a pointer to a type provided through a generic type parameter will fail.

void P<T>(T obj) 
    where T : struct
{
    T* ptr = &obj; // compile-time error
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents