Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#ActualLarryKing

Posted 03 January 2013 - 08:02 PM

All right! It's good to know that you can offset a pointer with an int.

I also like the idea of offsets relative to the position of the offset, although I wonder what would happen if you had a negative offset;

Theoretically it wouldn't matter and would still work.

 

Now, regarding the custom deleter, the deleter would call a "delete" function of the model, correct?

Would it then cast the Model* to a char* before finally calling delete[] foochar?

 

I assume the deleter would look something like this:

 

void DeleteModel( *Model)
{
     Model->Shutdown();
     delete[] (char*)Model;
}

 

Thankyou.

 

EDIT:

Your offset template is a really good idea!

It took me a moment to understand what it was doing - still new to C++


#1LarryKing

Posted 03 January 2013 - 07:49 PM

All right! It's good to know that you can offset a pointer with an int.

I also like the idea of offsets relative to the position of the offset, although I wonder what would happen if you had a negative offset;

Theoretically it wouldn't matter and would still work.

 

Now, regarding the custom deleter, the deleter would call a "delete" function of the model, correct?

Would it then cast the Model* to a char* before finally calling delete[] foochar?

 

I assume the deleter would look something like this:

 

void DeleteModel( *Model)
{
     Model->Shutdown();
     delete[] (char*)Model;
}

 

Thankyou.


PARTNERS