pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    1. <legend id='GAMB3'><style id='GAMB3'><dir id='GAMB3'><q id='GAMB3'></q></dir></style></legend>
      <tfoot id='GAMB3'></tfoot>

        <bdo id='GAMB3'></bdo><ul id='GAMB3'></ul>
      <i id='GAMB3'><tr id='GAMB3'><dt id='GAMB3'><q id='GAMB3'><span id='GAMB3'><b id='GAMB3'><form id='GAMB3'><ins id='GAMB3'></ins><ul id='GAMB3'></ul><sub id='GAMB3'></sub></form><legend id='GAMB3'></legend><bdo id='GAMB3'><pre id='GAMB3'><center id='GAMB3'></center></pre></bdo></b><th id='GAMB3'></th></span></q></dt></tr></i><div class="f7lrltf" id='GAMB3'><tfoot id='GAMB3'></tfoot><dl id='GAMB3'><fieldset id='GAMB3'></fieldset></dl></div>

      <small id='GAMB3'></small><noframes id='GAMB3'>

      1. C++如何鏈接模板實例

        How does C++ link template instances(C++如何鏈接模板實例)

        • <i id='GUMuN'><tr id='GUMuN'><dt id='GUMuN'><q id='GUMuN'><span id='GUMuN'><b id='GUMuN'><form id='GUMuN'><ins id='GUMuN'></ins><ul id='GUMuN'></ul><sub id='GUMuN'></sub></form><legend id='GUMuN'></legend><bdo id='GUMuN'><pre id='GUMuN'><center id='GUMuN'></center></pre></bdo></b><th id='GUMuN'></th></span></q></dt></tr></i><div class="vvtpbzn" id='GUMuN'><tfoot id='GUMuN'></tfoot><dl id='GUMuN'><fieldset id='GUMuN'></fieldset></dl></div>
          <tfoot id='GUMuN'></tfoot>

          • <legend id='GUMuN'><style id='GUMuN'><dir id='GUMuN'><q id='GUMuN'></q></dir></style></legend>
              <bdo id='GUMuN'></bdo><ul id='GUMuN'></ul>

              <small id='GUMuN'></small><noframes id='GUMuN'>

                    <tbody id='GUMuN'></tbody>
                  本文介紹了C++如何鏈接模板實例的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  如果我在包含兩個不同翻譯單元的頭文件中定義一個函數(可能是一個類成員函數但未內聯),我會收到鏈接錯誤,因為該函數是多重定義的.模板并非如此,因為在編譯器解析模板化類型的對象聲明之前,它們不是可編譯的類型.這讓我意識到我不知道編譯的模板代碼在哪里以及它是如何鏈接的,因為 C++ 不只是創建代碼的多個副本來定義 SomeTemplateClass.任何信息,將不勝感激.謝謝!

                  If I define a function (maybe a class member function but not inlined) in a header file that is included by two different translation units I get a link error since that function is multiply defined. Not so with templates since they are not compilable types until the compiler resolves a declaration of an object of a templatized type. This made me realize I don't know where compiled template code resides and how it is linked since C++ does not just create multiple copies of code to define SomeTemplateClass. Any info would be appreciated. Thanks!

                  推薦答案

                  C++編譯器使用了3種實現方案:

                  There are 3 implementation schemes used by C++ compilers:

                  • 貪婪實例化,編譯器在每個使用它的編譯單元中生成一個實例化,然后鏈接器丟棄除其中一個之外的所有實例化(這不僅僅是代碼大小優化,它是必需的,以便函數地址、static 變量等都是唯一的).這是最常見的模型.

                  • greedy instantiation, where the compiler generates an instantiation in each compilation unit that uses it, then the linker throws away all but one of them (this is not just a code-size optimization, it's required so that function addresses, static variables, and the like are unique). This is the most common model.

                  查詢實例化,其中編譯器有一個已經完成的實例化數據庫.當需要實例化時,會檢查并更新數據庫.我知道的唯一使用它的編譯器是 Sun 的,默認情況下不再使用它.

                  queried instantiation, where the compiler has a database of instantiations already done. When an instantiation is needed, the DB is checked and updated. The only compiler I know which uses this is Sun's, and it isn't used by default anymore.

                  迭代實例化,其中實例化由鏈接器進行(直接或通過將它們分配給編譯單元,然后重新編譯).這是 CFront 使用的模型 - 即歷史上它是第一個使用的模型 - 以及使用 EDG 前端的編譯器(與 CFront 相比進行了一些優化).

                  iterated instantiation, where the instantiations are made by the linker (either directly or by assigning them to a compilation unit, which will then be recompiled). This is the model used by CFront -- i.e. historically it was the first one used -- and also by compilers using the EDG front-end (with some optimisations compared to CFront).

                  (參見 C++ 模板,David Vandevoorde 和 Nicolai Josuttis 的完整指南.另一個在線參考是 http://www.bourguet.org/v2/cpplang/export.pdf,更關注編譯模型,但仍然有實例化機制的描述).

                  (See C++ Templates, The Complete Guide by David Vandevoorde and Nicolai Josuttis. Another online reference is http://www.bourguet.org/v2/cpplang/export.pdf, which is more concerned about the compilation model but still has descriptions of the instantiation mechanisms).

                  這篇關于C++如何鏈接模板實例的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Why do two functions have the same address?(為什么兩個函數的地址相同?)
                  Why the initializer of std::function has to be CopyConstructible?(為什么 std::function 的初始化程序必須是可復制構造的?)
                  mixing templates with polymorphism(混合模板與多態性)
                  When should I use the keyword quot;typenamequot; when using templates(我什么時候應該使用關鍵字“typename?使用模板時)
                  Dependent name resolution amp; namespace std / Standard Library(依賴名稱解析命名空間 std/標準庫)
                  gcc can compile a variadic template while clang cannot(gcc 可以編譯可變參數模板,而 clang 不能)
                    <tbody id='ZEJTp'></tbody>
                    <legend id='ZEJTp'><style id='ZEJTp'><dir id='ZEJTp'><q id='ZEJTp'></q></dir></style></legend>
                    <i id='ZEJTp'><tr id='ZEJTp'><dt id='ZEJTp'><q id='ZEJTp'><span id='ZEJTp'><b id='ZEJTp'><form id='ZEJTp'><ins id='ZEJTp'></ins><ul id='ZEJTp'></ul><sub id='ZEJTp'></sub></form><legend id='ZEJTp'></legend><bdo id='ZEJTp'><pre id='ZEJTp'><center id='ZEJTp'></center></pre></bdo></b><th id='ZEJTp'></th></span></q></dt></tr></i><div class="9xn7np7" id='ZEJTp'><tfoot id='ZEJTp'></tfoot><dl id='ZEJTp'><fieldset id='ZEJTp'></fieldset></dl></div>

                    <small id='ZEJTp'></small><noframes id='ZEJTp'>

                      • <bdo id='ZEJTp'></bdo><ul id='ZEJTp'></ul>

                          • <tfoot id='ZEJTp'></tfoot>
                          • 主站蜘蛛池模板: 空调风机,低噪声离心式通风机,不锈钢防爆风机,前倾皮带传动风机,后倾空调风机-山东捷风风机有限公司 | 洁净棚-洁净工作棚-无菌室-净化工程公司_北京卫护科技有限公司 | 电子厂招聘_工厂招聘_普工招聘_小时工招聘信息平台-众立方招工网 | 苏州同创电子有限公司 - 四探针测试仪源头厂家 | 消防泵-XBD单级卧式/立式消防泵-上海塑泉泵阀(集团)有限公司 | 武汉不干胶印刷_标签设计印刷_不干胶标签印刷厂 - 武汉不干胶标签印刷厂家 | 锂离子电池厂家-山东中信迪生电源| 建筑资质代办_工程施工资质办理_资质代办公司_北京众聚企服 | 低噪声电流前置放大器-SR570电流前置放大器-深圳市嘉士达精密仪器有限公司 | 中红外QCL激光器-其他连续-半导体连续激光器-筱晓光子 | 耳模扫描仪-定制耳机设计软件-DLP打印机-asiga打印机-fitshape「飞特西普」 | 可程式恒温恒湿试验箱|恒温恒湿箱|恒温恒湿试验箱|恒温恒湿老化试验箱|高低温试验箱价格报价-广东德瑞检测设备有限公司 | 江苏全风,高压风机,全风环保风机,全风环形高压风机,防爆高压风机厂家-江苏全风环保科技有限公司(官网) | 油漆辅料厂家_阴阳脚线_艺术漆厂家_内外墙涂料施工_乳胶漆专用防霉腻子粉_轻质粉刷石膏-魔法涂涂 | 乐之康护 - 专业护工服务平台,提供医院陪护-居家照护-居家康复 | 比士亚-专业恒温恒湿酒窖,酒柜,雪茄柜的设计定制 | 固诺家居-全屋定制十大品牌_整体衣柜木门橱柜招商加盟 | 量子管通环-自清洗过滤器-全自动反冲洗过滤器-沼河浸过滤器 | 科昊仪器超纯水机系统-可成气相液氮罐-美菱超低温冰箱-西安昊兴生物科技有限公司 | CE认证_FCC认证_CCC认证_MFI认证_UN38.3认证-微测检测 CNAS实验室 | 儋州在线-儋州招聘找工作、找房子、找对象,儋州综合生活信息门户! | hdpe土工膜-防渗膜-复合土工膜-长丝土工布价格-厂家直销「恒阳新材料」-山东恒阳新材料有限公司 ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 苏州防水公司_厂房屋面外墙防水_地下室卫生间防水堵漏-苏州伊诺尔防水工程有限公司 | 不锈钢螺丝,不锈钢螺栓,不锈钢标准件-江苏百德特种合金有限公司 交变/复合盐雾试验箱-高低温冲击试验箱_安奈设备产品供应杭州/江苏南京/安徽马鞍山合肥等全国各地 | 根系分析仪,大米外观品质检测仪,考种仪,藻类鉴定计数仪,叶面积仪,菌落计数仪,抑菌圈测量仪,抗生素效价测定仪,植物表型仪,冠层分析仪-杭州万深检测仪器网 | 北京成考网-北京成人高考网 | 【星耀裂变】_企微SCRM_任务宝_视频号分销裂变_企业微信裂变增长_私域流量_裂变营销 | 旋振筛|圆形摇摆筛|直线振动筛|滚筒筛|压榨机|河南天众机械设备有限公司 | 冲锋衣滑雪服厂家-冲锋衣定制工厂-滑雪服加工厂-广东睿牛户外(S-GERT) | 管理会计网-PCMA初级管理会计,中级管理会计考试网站 | 能量回馈_制动单元_电梯节能_能耗制动_深圳市合兴加能科技有限公司 | 抖音短视频运营_企业网站建设_网络推广_全网自媒体营销-东莞市凌天信息科技有限公司 | 不锈钢管件(不锈钢弯头,不锈钢三通,不锈钢大小头),不锈钢法兰「厂家」-浙江志通管阀 | 磁力抛光机_磁力研磨机_磁力去毛刺机-冠古设备厂家|维修|租赁【官网】 | 高压管道冲洗清洗机_液压剪叉式升降机平台厂家-林君机电 | 广州番禺搬家公司_天河黄埔搬家公司_企业工厂搬迁_日式搬家_广州搬家公司_厚道搬迁搬家公司 | CCC验厂-家用电器|服务器CCC认证咨询-奥测世纪 | 掺铥光纤放大器-C/L波段光纤放大器-小信号光纤放大器-合肥脉锐光电技术有限公司 | 塑料检查井_双扣聚氯乙烯增强管_双壁波纹管-河南中盈塑料制品有限公司 | 开锐教育-学历提升-职称评定-职业资格培训-积分入户 | 传动滚筒_厂家-淄博海恒机械制造厂 |