
11 Jan
2005
11 Jan
'05
3:21 a.m.
Noah Stein wrote:
Your Create() function in AllocateUsingNew isn't guaranteed to work for all classes. The type of the singleton class might have alignment restrictions. char has no alignment restrictions; therefore, the program may crash when trying to initialize the singleton. I believe boost::aligned_storage is your friend in this situation.
Thanks for the heads up. Although the implementation of AllocateUsingNew has since been changed and now is able to use regular new, my static allocation class still would have this problem. I'll look into aligned storage immediately. -Jason