Yes! Thank you Google. Not quite a pointer to the constructor that I bloody should be able to get (the resultant assembly code calls it directly like any other function, so why can't I?), but good enough.class STUPID { public: static void *ConstructoryEnough(void *pos) {return new(pos) STUPID;} }; typedef void* (*CONSTRUCTORPOINTER)(void*); void *ConstructMeOneOfThese(CONSTRUCTORPOINTER p,void *space) { p(space); } int main() { char buffer[sizeof(STUPID)]; void *(*pconstructor)(void*)=STUPID::ConstructoryEnough; ConstructMeOneOfThese(pconstructor,buffer); //constructor is called using only a pointer and an allocated space, yay ((STUPID*)buffer)->~STUPID(); //destructor called directly, but could be pointerised the same way } Hidden behind that block of code is a really great story about some funny things that happened to me when I went to the shops the other day, and also some pictures of really great things I saw - amusing and pornographic things. See what C++ does? You've all missed out on that fantastic material, and it's all because of C++ engaging in coverups.
[02:50]
|