内容案例ygwin-b20 include sgi stl constructSGI STL构造.pdf
G++2.91.57,cygnus\cygwin-b20\include\g++\stl_construct.h完整列表
/*
*
*Copyright(c)1994
*Hewlett-PackardCompany
*
*Permissiontouse,copy,modify,distributeandsellthissoftware
*anditsdocumentationforanypurposeisherebygrantedwithoutfee,
*providedthattheabovecopyrightnoticeappearinallcopiesand
*thatboththatcopyrightnoticeandthispermissionnoticeappear
*insupportingdocumentation.Hewlett-PackardCompanymakesno
*representationsaboutthesuitabilityofthissoftwareforany
*purpose.Itisprovidedasiswithoutexpressorimpliedwarranty.
*
*
*Copyright(c)1996,1997
*SiliconGraphicsComputerSystems,Inc.
*
*Permissiontouse,copy,modify,distributeandsellthissoftware
*anditsdocumentationforanypurposeisherebygrantedwithoutfee,
*providedthattheabovecopyrightnoticeappearinallcopiesand
*thatboththatcopyrightnoticeandthispermissionnoticeappear
*insupportingdocumentation.SiliconGraphicsmakesno
*representationsaboutthesuitabilityofthissoftwareforany
*purpose.Itisprovidedasiswithoutexpressorimpliedwarranty.
*/
/*NOTE:Thisisaninternalheaderfile,includedbyotherSTLheaders.
*Youshouldnotattempttouseitdirectly.
*/
#ifndef__SGI_STL_INTERNAL_CONSTRUCT_H
#define__SGI_STL_INTERNAL_CONSTRUCT_H
#includenew.h//欲使用placementnew,需先此檔
__STL_BEGIN_NAMESPACE
//以下是destroy()第⼀版本,接受⼀個指標。
templateclassT
inlinevoiddestroy(T*pointer){
pointer-~T();//喚起dtor~T()
}
templateclassT1,classT2
inlinevoidconstruct(T1*p,constT2value){
new(p)T1(value);//placementnew;喚起ctorT1(value);
}
//如果元素的數值型別(valuetype)有non-trivialdestructor…
templateclassForwardIterator
inlinevoid
__destroy_aux(ForwardIteratorfirst,ForwardIteratorlast,__fa