Quasar Posted November 22, 2010 I was trying to code a temporary workaround for the fact that sectors, linedefs, and polyobjects need to contain an instance of CPointThinker (the class previously known as degenmobj_t), but those objects are not themselves constructed currently. The best way to do this seemed to be with placement new; for example:for(i = 0; i < numPolyObjects; ++i) new (&(PolyObjects[i].spawnSpot)) CPointThinker; Without :: in front of the new, Visual C++ complains that CZoneLevelItem (the ultimate base class of thinkers currently)'s new operator does not accept two parameters. WITH :: in front of new, Visual C++ complains that the global new function does not accept two parameters. So wtf, where's my placement new?? 0 Share this post Link to post
Ladna Posted November 22, 2010 I'm no expert, but does it help to do: #include <new> for(i = 0; i < numPolyObjects; ++i) new (&(PolyObjects[i].spawnSpot)) CPointThinker();- Changed CPointThinker to CPointThinker() 0 Share this post Link to post
Quasar Posted November 22, 2010 Ladna said:I'm no expert, but does it help to do: #include <new> for(i = 0; i < numPolyObjects; ++i) new (&(PolyObjects[i].spawnSpot)) CPointThinker();- Changed CPointThinker to CPointThinker() I can't test right now, but I wouldn't expect the () to make a difference given the syntax. However #include <new> may or may not make a difference - I just got the impression from what I read online that it's not supposed to be required for using placement new. I'll try it when I get home unless a more authoritative answer appears before then ;) EDIT: Yep, #include <new> is the key. Confirmed with cplusplus.com (I should have checked there first huh ;) after testing it in the compiler. 0 Share this post Link to post