Although I have seen examples of using placement new with an argument to the constructor as so:
class ClassType {
public:
ClassType( int ) { }
};
int main ( int argc, char ** argv )
{
char memory[sizeof(ClassType)];
new ((void *)memory) ClassType( 3 ); //<--- the problem
}
GCC 3.3.1 refuses to compile it, giving the message:
<internal>:9: error: too many arguments to function `void* operator new(unsigned int)'
Does GCC 3.3.1 just not support placement new with initializers? I've tried to google this, but failed miserably. Or if anyone with a modern M$ compiler can try simply compiling that statement, and tell me if it does in fact actually compile or not.