Minggu, 20 Februari 2011

A Type-safe Generic Pointer

IntroductionSometimes there comes the need to store a pointer to an object whose type is not known at compile-time. The common method to achieve this in C++ is to store it in a void pointer. The void pointer can then be cast back to the appropriate type and used when required. Call-back functions[1] in libraries are a well-known example of this method; the user-data pointer is often a void

Tidak ada komentar:

Posting Komentar