Download

C++ question - weird function parameter (found in unreal)

I found this in PostProcessing.cpp:


Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessVisualizeMotionBlur());

What is this parameter? It looks lake two words, but there’s no comma. The function itself waits for - T InPass*, single parameter, nothing unusual. How does this structure call? How does it work?

Ok, I get it - it’s called “placement new”. It creates new object in memory, but in location, specified as argument to new(ptr).