Have you considered implementing your class as a template class that way
you can handle all the specific data types you want to D&D at
runtime
and get a more accurate value to allocate to memory using the sizeof() operator.
You might not know the type of the data being D&D so you might want to add the following header
#include <typeinfo.h>
to get the actually type of the data then call
typeid(theObject).name();
I have not actually used this but i vague remember it being handy in such a case. corrections welcome.
Or you could if else through all supported types and check for a not
null with a dynamic cast then apply the sizeof on the successful cast
From: "James Nzomo" <kazikubwa@gmail.com>
To: "Skunkworks Mailing List" <skunkworks@lists.my.co.ke>
Sent: Monday, November 28, 2011 1:01:49 PM
Subject: Re: [Skunkworks] Size of an object in memory at runtime
I'm using wxWidgets. It's clipboard mechanism extends the underlying platform's clipboard mechanism.
The object is of a custom class.
This class contains various datatypes ranging from ints,doubles,std::strings,char pointers to custom typedefs, structs and other classes.
The objects i want to D&D are of different types. I will have a clipboard data object for each type as opposed to having an abstract implementation which is more complex.
_______________________________________________
Good judgement comes from Experience.
Most of that comes from Bad Judgement.
_______________________________________________
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke