资源描述:
《侯捷stl源码剖析注释之17sgi-stl-33-function》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、SGISTL3.3stl_function.h完整列表/**Copyright(c)1994*Hewlett-PackardCompany**Permissiontouse,copy,modify,distributeandsellthissoftware*anditsdocumentationforanypurposeisherebygrantedwithoutfee,*providedthattheabovecopyrightnoticeappearinallcopiesand*thatbotht
2、hatcopyrightnoticeandthispermissionnoticeappear*insupportingdocumentation.Hewlett-PackardCompanymakesno*representationsaboutthesuitabilityofthissoftwareforany*purpose.Itisprovidednasis"withoutexpressorimpliedwarranty.*Copyright(c)1996-1998*SiliconGraphi
3、csComputerSystems,Inc.**Permissiontouse,copy,modify,distributeandsellthissoftware*anditsdocumentationforanypurposeisherebygrantedwithoutfee,*providedthattheabovecopyrightnoticeappearinallcopiesand*thatboththatcopyrightnoticeandthispermissionnoticeappear
4、*insupportingdocumentation.SiliconGraphicsmakesno*representationsaboutthesuitabilityofthissoftwareforany*purpose.Itisprovidednasis"withoutexpressorimpliedwarranty・/*NOTE:Thisisaninternalheaderfile,includedbyotherSTLheaders.*Youshouldnotattempttouseitdir
5、ectly.#ifndef—SGI_STL_INTERNAL_FUNCTION_H#defineSGISTLINTERNALFUNCTIONH_STL_BEGIN_NAMESPACEtemplatestructunary_function{typedef_Argargument_type;typedef_Resultresult_type;};templatestructbinary
6、_function{typedef_Arglfirst_argument_type;typedef_Arg2second_argument_type;typedef_Resultresult_type;};templatestructplus:publicbinary_function<_Tp,_Tpz_Tp>{_Tpoperator()(const_Tp&_xrconst_Tp&_y)const{return—x+—y;}};templatestructmin
7、us:publicbinary_functione_Tp,_Tp,_Tp>{_Tpoperator()(const_Tp&—xzconst_Tp&_y)const{return—x-—y;}};templatestructmultiplies:publicbinary_function<_Tpr_Tp,_Tp>{_Tpoperator()(const_Tp&x,const_Tp&y)const{returnx*y;}};templatestructdivides
8、:publicbiri3ry_function<_Tp,_Tp,_Tp>{_Tpoperator()(const_Tp&_xzconst_Tp&—y)const{return_x/_y;}};//identity_eleinent(notpartoftheC++standard)•templateinline_Tpidentity_element(plus<_Tp>)(return_Tp(0);}templatei