cginternals / globjects

C++ library strictly wrapping OpenGL objects.
https://globjects.org
MIT License
539 stars 59 forks source link

Rethink static casts to Referenced in ref_ptr #216

Closed rlux closed 10 years ago

rlux commented 10 years ago

We decided to static_cast the template parameter T of ref_ptr to a Referenced. This allows us to create ref_ptr's to forward declared types. However this is very dangerous, as it completely circumvents the type checks. This will not work for types with multipe and/or virtual inheritence.

Do we want the forward declaration feature that badly, that we can accept dangerous code?

scheibel commented 10 years ago

I don't think it is acceptable to use dangereous code without checking for erroneous cases (which requires the class to be declared at compile time, and not just an available forward declareation).