Placement syntax: Difference between revisions

Content deleted Content added
RHaden (talk | contribs)
m Fixed capitalization error.
m Do general fixes and cleanup. - using AWB (9100)
Line 10:
== Expressions ==
The Standard C++ syntax for a non-placement <code>new</code> expression is<ref name=Lischner2003 />
:<code>new</code> ''new-type-id'' ( ''optional-initializer-expression-list'' )</code>
 
The placement syntax adds an expression list immediately after the <code>new</code> keyword. This expression list is the placement. It can contain any number of expressions.<ref name=Lischner2003 /><ref name=Lippman1997 /><ref name=Loudon2003 />
:<code>new</code> ( ''expression-list'' ) ''new-type-id'' ( ''optional-initializer-expression-list'' )</code>
 
There is no placement delete expression.<ref name=SolterKleper2005 />
Line 91:
{ return here ; }
</source>
 
 
In your case, using this is not required as an int is [[Plain old data structure|POD]], it has a trivial constructor. If you want to use it, you could use it this way:<source lang="cpp" enclose=div>
Line 304 ⟶ 303:
*{{cite book|ref=harv|title=Multi-paradigm Programming Using C++|first=Dirk|last=Vermeir|publisher=Springer|year=2001|isbn=1-85233-483-5|isbn13=9781852334833}}
*{{cite web|ref=harv|title=A Cross-Platform Memory Leak Detector|date=2007-12-31|first=Wu|last=Yongwei|accessdate=2008-11-26|work=Wu Yongwei's Programming Page|url=http://wyw.dcweb.cn/leakage.htm}}
Detector|date=2007-12-31|first=Wu|last=Yongwei|accessdate=2008-11-26|work=Wu Yongwei's Programming Page|url=http://wyw.dcweb.cn/leakage.htm}}
{{refend}}