Fair enough.
Example:
Alright, now everyone is happy. I have added a healthy level of sarcasm to a few lines of code (which always brightens my day). I still say you are just a quick one. Of course, your name is laserlight, I should expect you to be swift.Code:inline template<typename AnyTypeYouWant>
AnyTypeYouWant *malloc_ptr(size_t x)
{
return reinterpret_cast<AnyTypeYouWant *>(malloc(size_t * sizeof(AnyTypeYouWant)));
}
inline template<typename AnyTypeYouWant>
AnyTypeYouWant &malloc_ref(size_t x)
{
AnyTypeYouWant *ptr = malloc_ptr(x);
if(!ptr)
{
throw std::bad_alloc("Null reference");
}
return *ptr;
}