Placement syntax: Difference between revisions

Content deleted Content added
Line 236:
:<source lang="cpp" enclose=div>
#include <cstdlib>
#include <iostream>
 
struct A {} ;
Line 245 ⟶ 246:
} ;
 
void * operator new ( std::size_t, const A & ) ;
{std::cout << "Placement new called." << std::endl;}
void operator delete ( void *, const A & ) ;
{std::cout << "Placement delete called." << std::endl;}
 
int main ()
{
A a ;
try {
T * p = new (a) T ;
} catch (E exp) {std::cout << "Exception caught." << std::endl;}
return 0 ;
}
 
</source>