C++ 式語言的新標準.pptx

  1. 1、本文档共61页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C++ 程式語言的新標準王建興qing.chwang@講者簡介EducationPh.D. Candidate, Department of Computer Science, National Tsing-Hua University, TaiwanResearch interests: distribute network management, mobile agent, VoIP, and p2p networking, sensor networkBook TranslationThinking in Java 4nd Edition, in Traditional ChineseThinking in Java 2nd Edition, in Traditional ChineseEssential C++, in Traditional Chinese專欄iTHome 電腦報程式人專欄HonorThe champion of the Trend Micro Programming Contest 2004 2009通訊大賽-Android手機軟體設計競賽第三名Agendaauto Keyworddecltype Type SpecifierLambda ExpressionRvalue Referencestatic_assert Declarationnullptr Keywords*少林足球中片段大師兄即將歸位*少林足球中片段C++ 王者歸來*魔戒三部曲海報何謂 C++0x目前一般所使用的 C++ 語法標準,實際上大部分應該都是所謂 C++98 / C++03 的 ISO/IEC 14882:1998、ISO/IEC 14882:2003 尚在草案階段的 C++0x ( 讀音:see plus plus oh ex ) 則是 C++ 語言的新標準Bjarne Stroustrup 宣稱 C++0x 將會近乎 100% 相容於現有的標準 C++C++0x Core Language Features In VC10: The Table (1/3)*/b/vcblog/archive/2010/04/06/c-0x-core-language-features-in-vc10-the-table.aspxC++0x Core Language Features In VC10: The Table (2/3)C++0x Core Language Features In VC10: The Table (3/3)今天要談的 C++0x 特色auto Keyworddecltype Type SpecifierLambda Expressionsrvalue referencesstatic_assertnullptrauto keywordauto Keyword (1/3)auto 關鍵字能從所宣告變數的初始算式,導出其型別 ( 當然是編譯時期 )auto declarator initializer; int j = 0; auto k = 0; // Variable k is implicitly type int*/en-us/library/dd293667(v=VS.100).aspxauto Keyword (2/3)mapint,liststring::iterator i = m.begin(); auto i = m.begin(); auto x = 1, *y = x, **z = y;// Resolves to int. auto a(2.01), *b (a); // Resolves to double. auto c = a, *d(c); // Resolves to char. auto m = 1, n = m; // Resolves to int. auto Keyword (3/3)使用 auto 關鍵字時的重要限制使用時一定要搭配 initializer不能用來宣告陣列、變數的 return type、函式或 template 的參數 除了 static member 之外,不能在 class/struct 中使用 auto 宣告 data member錯誤的 auto 使用auto a;auto ary[10];auto ary2[] = { 1, 2, 3}auto foo();void bar(auto a);struct A{ auto a;};使用 auto 的時機當資料型別可能隨著編譯器或目標平台而異時例 strlen() 的回傳型別當資料型別過於複雜不易表示時例 mapint,liststring::iterator i 將 Lambdas 指派

文档评论(0)

wxc6688 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档