C++ template specialization, calling methods on types that could be pointers or references unambiguously
Small overloaded functions can be used to turn reference into pointer: template<typename T> T * ptr(T & obj) { return &obj; } //turn reference into pointer! template<typename T> T * ptr(T * obj) { return obj; } //obj is already pointer, return it! Now instead of doing this: if(elem->Intersects(_bounds) == false) return false; if(elem.Intersects(_bounds) == … Read more