锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产美女久久精品香蕉69,久久久久久久久久久久中文字幕 ,久久91精品国产91久http://www.shnenglu.com/kyline/On my wayzh-cnWed, 07 May 2025 00:06:14 GMTWed, 07 May 2025 00:06:14 GMT60銆愯漿銆戝璇濇浠誨姟鏍忛殣钘?/title><link>http://www.shnenglu.com/kyline/archive/2009/05/07/82136.html</link><dc:creator>璋蜂富</dc:creator><author>璋蜂富</author><pubDate>Thu, 07 May 2009 03:19:00 GMT</pubDate><guid>http://www.shnenglu.com/kyline/archive/2009/05/07/82136.html</guid><wfw:comment>http://www.shnenglu.com/kyline/comments/82136.html</wfw:comment><comments>http://www.shnenglu.com/kyline/archive/2009/05/07/82136.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/kyline/comments/commentRss/82136.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/kyline/services/trackbacks/82136.html</trackback:ping><description><![CDATA[闅愯棌榪欎釜Main Dialog鐨勬濊礬灝辨槸鎶婅繖涓狣ialog鐪嬫垚涓涓瓙紿楀彛錛岀劧鍚庡啀鎶奧S_EX_APPWINDOW灞炴у幓鎺夈?br>WS_EX_APPWINDOW涓嶅ぇ甯哥敤錛孧SDN鐨勮В閲婃槸錛? <pre> Forces a top-level window onto the taskbar when the window is visible. </pre> 鎶婇《灞傜殑騫朵笖鍙鐨勭獥鍙f斁鍒頒換鍔℃爮涓婏紝縐婚櫎 WS_EX_APPWINDOW 寰堝鏄擄細(xì) <pre> ModifyStyleEx(WS_EX_APPWINDOW, 0); </pre> 灝卞彲浠ヤ簡(jiǎn)銆?br><br>閭d箞浠涔堝姙娉曡兘澶熸渶綆鍗曠殑瀹炵幇鍒涘緩涓涓埗紿楀彛鍛紵CFrameWnd 灝辨湁鐐圭浜?jiǎn)锛岒q茶剢灝辯敤鑷繁濂戒簡(jiǎn)銆傚湪<br>BOOL CHideApp::InitInstance()涓細(xì)<br> <pre> CHideDlg dlgParent; dlgParent.Create(IDD_HIDE_DIALOG); dlgParent.ShowWindow(SW_HIDE); //dlgParent.ShowWindow(SW_SHOW); CHideDlg dlg(&dlgParent); m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); dlgParent.DestroyWindow(); </pre> 鍦˙OOL CHideDlg::OnInitDialog()涓細(xì) <pre> this->ModifyStyleEx(WS_EX_APPWINDOW, 0); </pre> 鍙煭鐭嚑琛岋紝灝卞疄鐜頒簡(jiǎn)瀵硅瘽妗嗗湪浠誨姟鏍忕殑闅愯棌銆?br><br><img src="http://www.vckbase.com/document/image/paragraph.gif"> <strong>緇撴潫璇?/strong><br>銆銆濡傛灉浣跨敤 CDialog 鐨勮瘽錛孉LT+TAB 鍥炬爣灝變笉瀵逛簡(jiǎn):) 涔嬪墠鎴戜篃璇曡繃鐢?CWnd錛屽彲鎭ㄧ殑鏄畠榪樿鍘繪敞鍐岀獥鍙g被錛岀浉姣斾箣涓嬭繕鏄疌HideDlg 鏈緇忔祹錛屼綘璇村憿錛熺澶у韜綋鍋ュ悍錛屾瘡澶╅兘鏈夋柊鍙戠幇錛?br><br>E-Mail : webmaster@sanjin.51.net QQ : 923452 <img src ="http://www.shnenglu.com/kyline/aggbug/82136.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/kyline/" target="_blank">璋蜂富</a> 2009-05-07 11:19 <a href="http://www.shnenglu.com/kyline/archive/2009/05/07/82136.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>VS 2010 C++ 鐜嬭呭綊鏉?/title><link>http://www.shnenglu.com/kyline/archive/2009/04/27/81217.html</link><dc:creator>璋蜂富</dc:creator><author>璋蜂富</author><pubDate>Mon, 27 Apr 2009 08:02:00 GMT</pubDate><guid>http://www.shnenglu.com/kyline/archive/2009/04/27/81217.html</guid><wfw:comment>http://www.shnenglu.com/kyline/comments/81217.html</wfw:comment><comments>http://www.shnenglu.com/kyline/archive/2009/04/27/81217.html#Feedback</comments><slash:comments>13</slash:comments><wfw:commentRss>http://www.shnenglu.com/kyline/comments/commentRss/81217.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/kyline/services/trackbacks/81217.html</trackback:ping><description><![CDATA[浣滀負(fù)Visual C++紼嬪簭鍛橈紝澶у蹇?jī)閲岄兘寰堟唻灞堝Q佸ぇ瀹墮兘鍦ㄩ棶錛孷isual C++鐨勫墠閫斿湪鍝噷錛熷潥鎸丆++榪樻湁娌℃湁鎰忎箟錛?br><br>  鍦╒isual Studio 2010涓垜浠壘鍒頒簡(jiǎn)絳旀錛屾壘鍒頒簡(jiǎn)C++鐨勬湭鏉ワ細(xì)C++鐜嬭呭綊鏉ワ紒 <div>  铏界劧鍦–++鐨勫彂灞曞巻紼嬩腑緇忓巻浜?jiǎn)涓姌q板皬灝忕殑娉㈡姌錛屼絾鏄垜浠簲褰撶湅鍒幫紝涓栫晫涓婅繕鏈夋棤鏁扮殑C++浠g爜鍦ㄧǔ瀹氬湴榪愯鐫錛岃繖浜涗唬鐮佽繕闇瑕佺淮鎶わ紝闇瑕佸崌綰с傚彟澶栵紝C++鍦ㄦ煇浜涢鍩熻繕鏄叿鏈変笉鍙浛浠g殑浼樺娍錛屾棤鏁板熀浜嶤++鐨勬柊欏圭洰姝e湪榪涜鐫銆傚井杞篃閫愭笎鎰忚瘑鍒頒簡(jiǎn)榪欎竴鐐癸紝寮濮嬩笉鏂寮篤isual Studio瀵笴++鐨勬敮鎸佸姏搴︺傚湪榪欐鐨刅isual Studio 2010 CTP涓紝鏃犺鏄粠C++璇█鏈韓榪樻槸浠嶪DE鏂歸潰錛岄兘緇欐垜浠甫鏉ヤ簡(jiǎn)寰堝鏈熺浖宸蹭箙鐨勬柊鐗規(guī)с傝姳寮涓ゆ湹錛屽悇琛ㄤ竴鏋濄傛垜浠繖閲屾寜涓媀isual Studio 2010鍦↖DE鏂歸潰鐨勫寮轟笉琛紝鍗曡瀹冨鍗沖皢鍒版潵鐨凜++鏂版爣鍑咰++0x鐨勬敮鎸併?/div> <div><br>  C++鐨勬柊鏍囧噯C++0x铏界劧榪樻病鏈夋寮忓彂甯冿紝浣嗘槸宸茬粡榪涘叆浜?jiǎn)feature freeze鐨勯樁孌碉紝寰堝浜洪兘鍦ㄧ寽嫻婥++0x涓殑x鍒板簳鏄?榪樻槸10錛屼粠鐩墠鐨勬儏鍐墊潵鐪嬶紝9鏄渶澶х殑鍙兘浜?jiǎn)銆俈isual Studio 2010浣滀負(fù)涓嬩竴浠e紑鍙戝伐鍏鳳紝褰撶劧涓嶄細(xì)閿欒繃瀵規(guī)柊鐨凜++鏍囧噯C++0x鐨勬敮鎸併傞櫎浜?jiǎn)闅忕潃涔嬪墠鍙戝竷鐨刅isual C++ Feature Pack鑰屽紩鍏ョ殑TR1鍖呭惈鐨勯儴鍒嗙壒鎬у錛屽湪鏂扮殑Visual Studio 2010涓紝榪樺紩鍏ヤ簡(jiǎn)4涓噸瑕佺殑C++鏂扮壒鎬с傚彿縐癈++0x鐨?#8220;鍥涘ぇ澶╃帇”銆傝繖浜涙柊鐗規(guī)х殑寮曞叆錛屽繀灝嗙粰C(jī)++娉ㄥ叆鏂扮殑媧誨姏銆?/div> <div> <div><strong><br>  Lambda琛ㄨ揪寮?/strong></div> </div> <div><br>  寰堝緙栫▼緙栫▼璇█閮芥敮鎸佸尶鍚嶅嚱鏁?anonymous function)銆傛墍璋撳尶鍚嶅嚱鏁幫紝灝辨槸榪欎釜鍑芥暟鍙湁鍑芥暟浣擄紝鑰屾病鏈夊嚱鏁板悕銆侺ambda琛ㄨ揪寮忓氨鏄疄鐜板尶鍚嶅嚱鏁扮殑涓縐嶇紪紼嬫妧宸э紝瀹冧負(fù)緙栧啓鍖垮悕鍑芥暟鎻愪緵浜?jiǎn)绠鏄庣殑鍑芥暟寮忕殑鍙ユ硶銆傚悓鏍鋒槸Visual Studio涓殑寮鍙戣璦錛孷isual Basic鍜孷isual C#鏃╁氨瀹炵幇浜?jiǎn)瀵筁ambda琛ㄨ揪寮忕殑鏀寔錛岀粓浜嶸isual C++榪欐涔熶笉鐢樿惤鍚庯紝鍦╒isual Studio 2010涓坊鍔犱簡(jiǎn)瀵筁ambda琛ㄨ揪寮忕殑鏀寔銆?/div> <p>  Lambda琛ㄨ揪寮忎嬌寰楀嚱鏁板彲浠ュ湪浣跨敤鐨勫湴鏂瑰畾涔夛紝騫朵笖鍙互鍦↙ambda鍑芥暟涓嬌鐢↙ambda鍑芥暟涔嬪鐨勬暟鎹傝繖灝變負(fù)閽堝闆嗗悎鎿嶄綔甯︽潵浜?jiǎn)寰堝ぇ鐨勪究鍒┿傚湪浣滅敤涓婏紝Lambda琛ㄨ揪寮忕被浼間簬鍑芥暟鎸囬拡鍜屽嚱鏁板璞★紝Lambda琛ㄨ揪寮忓緢濂藉湴鍏奸【浜?jiǎn)鍑芥暟鎸囬拡鍜屽嚱鏁板璞$殑浼樼偣锛屽嵈娌℃湁瀹冧滑鐨劸~虹偣銆傜浉瀵逛簬鍑芥暟鎸囬拡鎴栨槸鍑芥暟瀵硅薄澶嶆潅鐨勮娉曞艦寮忥紝Lambda琛ㄨ揪寮忎嬌鐢ㄩ潪甯哥畝鍗曠殑璇硶灝卞彲浠ュ疄鐜板悓鏍風(fēng)殑鍔熻兘錛岄檷浣庝簡(jiǎn)Lambda琛ㄨ揪寮忕殑瀛︿範(fàn)闅懼害錛岄伩鍏嶄簡(jiǎn)浣跨敤澶嶆潅鐨勫嚱鏁板璞℃垨鏄嚱鏁版寚閽堟墍甯︽潵鐨勯敊璇傛垜浠彲浠ョ湅涓涓疄闄呯殑渚嬪瓙錛?/p> <div style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; PADDING-BOTTOM: 4px; PADDING-LEFT: 5.4pt; WIDTH: 98%; PADDING-RIGHT: 5.4pt; BACKGROUND: #e6e6e6; WORD-BREAK: break-all; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid; PADDING-TOP: 4px"> <div><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> LambdaDemo.cpp : Defines the entry point </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> the console application.<br></span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br><br>#include </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">stdafx.h</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">algorithm</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">ostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">vector</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><br></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br><br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> _tmain(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, _TCHAR</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> argv[])<br>{<br>    vector</span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> v;<br>    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">10</span><span style="COLOR: #000000">; </span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">i) {<br>        v.push_back(i);<br>    }<br>         for_each(v.begin(), v.end(), [] (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n) {<br>        cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> n;<br>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (n % </span><span style="COLOR: #800080">2</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">0</span><span style="COLOR: #000000">) {<br>            cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000"> even </span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">;<br>        } </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> {<br>            cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000"> odd </span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">;<br>        }<br>    });<br>    cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> endl;<br><br>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">0</span><span style="COLOR: #000000">;<br>}</span></div> </div> <div><br>  榪欐浠g爜寰幆閬嶅巻杈撳嚭vector涓殑姣忎竴涓暟錛屽茍鍒ゆ柇榪欎釜鏁版槸濂囨暟榪樻槸鍋舵暟銆傛垜浠彲浠ラ殢鏃朵慨鏀筁ambda琛ㄨ揪寮忚屾敼鍙樿繖涓尶鍚嶅嚱鏁扮殑瀹炵幇錛屼慨鏀瑰闆嗗悎鐨勬搷浣溿傚湪榪欐浠g爜涓紝C++浣跨敤涓瀵逛腑鎷彿“[]”鏉ヨ〃紺篖ambda琛ㄨ揪寮忕殑寮濮嬶紝鍏跺悗鐨?#8221;(int n)”琛ㄧずLambda琛ㄨ揪寮忕殑鍙傛暟銆傝繖浜涘弬鏁板皢鍦↙ambda琛ㄨ揪寮忎腑浣跨敤鍒般備負(fù)浜?jiǎn)浣撲細(xì)Lambda琛ㄨ揪寮忕殑綆媧侊紝鎴戜滑鏉ョ湅鐪嬪悓鏍風(fēng)殑鍔熻兘錛屽浣曚嬌鐢ㄥ嚱鏁板璞″疄鐜幫細(xì)<br> </div> <div style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; PADDING-BOTTOM: 4px; PADDING-LEFT: 5.4pt; WIDTH: 98%; PADDING-RIGHT: 5.4pt; BACKGROUND: #e6e6e6; WORD-BREAK: break-all; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid; PADDING-TOP: 4px"> <div><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: #000000">#include </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">stdafx.h</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">algorithm</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">ostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">vector</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br><br>struct LambdaFunctor {<br>    void operator()(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n) </span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> {<br>        cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> n </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">;<br>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (n % </span><span style="COLOR: #800080">2</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">0</span><span style="COLOR: #000000">) {<br>            cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000"> even </span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">;<br>        } </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> {<br>            cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000"> odd </span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">;<br>        }<br><br>    }<br>};<br><br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> _tmain(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, _TCHAR</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> argv[])<br>{<br>    vector</span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> v;<br><br>    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">10</span><span style="COLOR: #000000">; </span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">i) {<br>        v.push_back(i);<br>    }<br><br>    for_each(v.begin(), v.end(), LambdaFunctor());<br>    cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> endl;<br><br>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">0</span><span style="COLOR: #000000">;<br>}</span></div> </div> <p>  閫氳繃姣旇緝鎴戜滑灝卞彲浠ュ彂鐜幫紝Lambda琛ㄨ揪寮忕殑璇硶鏇村姞綆媧侊紝浣跨敤璧鋒潵鏇村姞綆鍗曢珮鏁堛?br><br><strong>闈?rùn)鎬佹柇璦static_assert<br><br></strong>  鍦ㄤ箣鍓嶇殑C++鏍囧噯C++03涓紝鎴戜滑鍙互浣跨敤涓ょ鏂█錛?br>  • 浣跨敤棰勫鐞嗕腑鐨勬潯浠剁紪璇戝拰#error鎸囦護(hù)錛屽彲浠ュ湪棰勫鐞嗛樁孌墊鏌ヤ竴浜涚紪璇戞潯浠?br>  • 鍙互浣跨敤瀹廰ssert鏉ヨ繘琛岃繍琛屾椂媯(gè)鏌ワ紝浠ョ‘淇濈▼搴忛昏緫鐨勬紜?br><br>  浣嗕嬌鐢?error鏂規(guī)硶鏄潪甯哥儲(chǔ)鐞愮殑錛屽茍涓斾笉鑳藉瀵規(guī)ā鏉垮弬鏁拌繘琛屾鏌ワ紝鍥犱負(fù)妯℃澘瀹炰緥鍖栨槸鍦ㄧ紪璇戞椂榪涜錛岃?error鏂規(guī)硶鏄湪棰勫鐞嗛樁孌佃繘琛岀殑銆傝宎ssert瀹忔槸鍦ㄨ繍琛屾椂榪涜媯(gè)鏌ャ備笉闅懼彂鐜幫紝鎴戜滑緙哄皯浜?jiǎn)涓鏍蜂笢瑗匡紝閭e氨鏄彲鐢ㄤ簬鍦ㄧ紪璇戞椂媯(gè)鏌ョ殑宸ュ叿銆備簬鏄紝闈?rùn)鎬佹柇璦搴旇繍鑰岀敓銆?br><br>  鍦ㄦ柊鐨凜++鏍囧噯C++0x涓紝鍔犲叆浜?jiǎn)瀵归潤(rùn)鎬佹柇璦鐨勬敮鎸侊紝寮曞叆浜?jiǎn)鏂扮殑鍏抽敭瀛梥tatic_assert鏉ヨ〃紺洪潤(rùn)鎬佹柇璦銆備嬌鐢ㄩ潤(rùn)鎬佹柇璦錛屾垜浠彲浠ュ湪紼嬪簭鐨勭紪璇戞椂鏈熸嫻嬩竴浜涙潯浠舵槸鍚︽垚绔嬶紝榪欎釜鐗規(guī)у湪璋冭瘯妯℃澘鍑芥暟鐨勬ā鏉垮弬鏁版椂鐗瑰埆鏈夌敤銆傚湪緙栬瘧鐨勬椂鍊欙紝妯℃澘鍑芥暟瀹炰緥鍖栵紝榪欐椂鎴戜滑灝卞彲浠ヤ嬌鐢ㄩ潤(rùn)鎬佹柇璦鍘繪祴璇曟ā鏉垮嚱鏁扮殑鍙傛暟鏄惁鎸夌収鎴戜滑鐨勮璁℃嫢鏈夊悎閫傜殑鍊箋備緥濡備笅闈㈣繖孌典唬鐮侊細(xì)</p> <div style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; PADDING-BOTTOM: 4px; PADDING-LEFT: 5.4pt; WIDTH: 98%; PADDING-RIGHT: 5.4pt; BACKGROUND: #e6e6e6; WORD-BREAK: break-all; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid; PADDING-TOP: 4px"> <div><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: #000000">template </span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> N</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> struct Kitten {<br>    static_assert(N </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">2</span><span style="COLOR: #000000">, </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">Kitten<N> requires N < 2.</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">);<br>};<br><br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main() {<br>    Kitten</span><span style="COLOR: #000000"><</span><span style="COLOR: #800080">1</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> peppermint;<br>    Kitten</span><span style="COLOR: #000000"><</span><span style="COLOR: #800080">3</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> jazz;<br><br>   </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">0</span><span style="COLOR: #000000">;<br>}</span></div> </div> <p>  褰撴垜浠湪涓誨嚱鏁頒腑浣跨敤“1”鍘誨疄渚嬪寲Kitten榪欎釜緇撴瀯浣撴椂錛屽湪緙栬瘧鐨勬椂鍊欙紝闈?rùn)鎬佹柇璦static_assert浼?xì)娴嬭瘯鍙傛暟N鐨勫鹼紝褰揘鐨勫煎皬浜?鏃跺氨浼?xì)漶旂敓涓涓柇璦閿欒錛屽茍灝嗙浉搴旂殑璋冭瘯甯姪淇℃伅杈撳嚭鍒?#8220;Error List”紿楀彛涓紝榪欐牱紼嬪簭鍛樺氨鍙互瀵歸棶棰樺揩閫熷畾浣嶏紝瑙e喅闂灝辨洿鍔犳柟渚夸簡(jiǎn)銆?br> </p> <p style="TEXT-ALIGN: center"><img style="WIDTH: 521px; HEIGHT: 171px" border=0 alt="" src="http://image4.it168.com/2008/12/24/99c76e78-a0d4-4112-9bc3-acddcf64dad0.jpg" width=537 height=291><br>鍥? static_assert鏂█鍙?qiáng)鍏惰緭鍑?/p> <p style="TEXT-ALIGN: left"><br>  鍙﹀錛岄潤(rùn)鎬佹柇璦榪樺甫鏉ュ緢澶氬叾浠栫殑浼樺娍銆備緥濡傞潤(rùn)鎬佹柇璦鍦ㄧ紪璇戞椂榪涜澶勭悊錛屼笉浼?xì)漶旂敓鋼Q浣曡繍琛屾椂鍒葷┖闂村拰鏃墮棿涓婄殑寮閿錛岃繖灝變嬌寰楀畠姣攁ssert瀹忓叿鏈夋洿濂界殑鏁堢巼銆傚彟澶栨瘮杈冮噸瑕佺殑涓涓壒鎬ф槸濡傛灉鏂█澶辮觸錛屽畠浼?xì)漶旂敓鏈夋剰涔変笖鍏呭垎鐨勮瘖鏂俊鎭Q屽府鍔╃▼搴忓憳蹇熻В鍐抽棶棰樸?br><br><strong>  auto鍏抽敭瀛?br></strong><br>  鍦–++0x涓紝auto鍏抽敭瀛楃殑鎰忎箟鍙戠敓浜?jiǎn)鏀瑰彉銆備粠Visual C++ 2010寮濮嬶紝auto鍏抽敭瀛楀皢鐢ㄤ簬鎸囧紩緙栬瘧鍣ㄦ牴鎹彉閲忕殑鍒濆鍊兼潵鍐沖畾鍙橀噺鐨勬暟鎹被鍨嬨傛崲鍙ヨ瘽璇達(dá)紝鎴戜滑鍙互鎶奱uto褰撴垚涓縐嶆柊鐨勬暟鎹被鍨嬶紝瀹冨彲浠?#8220;浠庡垵濮嬪寲鍣?initialize)涓帹瀵煎嚭鎵浠h〃鐨勫彉閲忕殑鐪熸綾誨瀷”銆傝繖縐嶅auto鍏抽敭瀛楃殑浣跨敤鏂瑰紡鍙互澶уぇ娑堥櫎褰撳墠鏇夸唬鏂瑰紡鎵瀵艱嚧鐨勫啑闀垮拰鏄撳嚭閿欑殑浠g爜銆傛垜浠湅涓涓疄闄呯殑渚嬪瓙錛?/p> <div style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; PADDING-BOTTOM: 4px; PADDING-LEFT: 5.4pt; WIDTH: 98%; PADDING-RIGHT: 5.4pt; BACKGROUND: #e6e6e6; WORD-BREAK: break-all; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid; PADDING-TOP: 4px"> <div><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">map</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">ostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">regex</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std::tr1;<br><br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main() {<br>    map</span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">, </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> m;<br><br>    </span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> regex r(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">(\\w+) (\\w+)</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">);<br><br>    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> s; getline(cin, s); ) {<br>        smatch results;<br>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (regex_match(s, results, r)) {<br>            m[results[</span><span style="COLOR: #800080">1</span><span style="COLOR: #000000">]] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> results[</span><span style="COLOR: #800080">2</span><span style="COLOR: #000000">];<br>        }<br>    }<br>    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">auto</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> m.begin(); i !</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> m.end(); </span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">i) {<br>        cout </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> i</span><span style="COLOR: #000000">-></span><span style="COLOR: #0000ff">second</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000"> are </span><span style="COLOR: #800000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> i</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">first </span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000"> endl;<br>    }<br><br>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">0</span><span style="COLOR: #000000">;<br>}</span></div> </div> <p>  鍦ㄨ繖孌典唬鐮佷腑錛屾垜浠嬌鐢╝uto鍏抽敭瀛楁潵浠f浛浜?jiǎn)鐪熸鐨勬暟鎹c誨瀷map<string, string>::iterator錛岃繖浣垮緱鏁翠釜浠g爜鑷劧鑰岀畝媧併?br><br>  鍙﹀錛岃窡鍏朵粬鏁版嵁綾誨瀷涓鏍鳳紝鎴戜滑涔熷彲浠ュauto鍏抽敭瀛楄繘琛屼慨楗幫紝渚嬪娣誨姞const錛屾寚閽?*)錛屽乏鍊煎紩鐢?&)錛屽彸鍊煎紩鐢?&&)絳夌瓑錛岀紪璇戝櫒浼?xì)鏍规嵁a(chǎn)uto綾誨瀷鎵浠h〃鐨勭湡姝g殑鏁版嵁鏉ュ喅瀹氳繖浜涗慨楗扮殑鍏蜂綋鍚箟銆?br><br>  涓轟簡(jiǎn)鍏煎涓浜涙棫鏈夌殑C++浠g爜錛屾垜浠彲浠ヤ嬌鐢?Zc:auto榪欎釜緙栬瘧鍣ㄩ夐」錛屾潵鍛婅瘔緙栬瘧鍣ㄦ槸閲囩敤auto鍏抽敭瀛楃殑鍘熸湁瀹氫箟榪樻槸鍦ㄦ柊鏍囧噯C++0x涓殑瀹氫箟銆?/p> <strong>鍙沖煎紩鐢?br><br></strong>  浣滀負(fù)鏈閲嶈鐨勪竴欏硅璦鐗規(guī)э紝鍙沖煎紩鐢?rvalue references)琚紩鍏ュ埌 C++0x涓傛垜浠彲浠ラ氳繃鎿嶄綔絎?#8220;&&”鏉ュ0鏄庝竴涓彸鍊煎紩鐢紝鍘熷厛鍦–++涓嬌鐢?#8220;&”鎿嶄綔絎﹀0鏄庣殑寮曠敤鐜板湪琚О涓哄乏鍊煎紩鐢ㄣ?nbsp; <div style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; PADDING-BOTTOM: 4px; PADDING-LEFT: 5.4pt; WIDTH: 98%; PADDING-RIGHT: 5.4pt; BACKGROUND: #e6e6e6; WORD-BREAK: break-all; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid; PADDING-TOP: 4px"> <div><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> a;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000"> a_lvref </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> a;  </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> 宸﹀煎紩鐢?br><br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> b;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000"> b_rvref </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> b;  </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> 鍙沖煎簲鐢?/span></div> </div> <p>  宸﹀煎紩鐢ㄥ拰鍙沖煎紩鐢ㄧ殑琛ㄧ幇琛屼負(fù)鍩烘湰涓鑷達(dá)紝瀹冧滑鍞竴鐨勫樊鍒氨鏄彸鍊煎紩鐢ㄥ彲浠ョ粦瀹氬埌涓涓復(fù)鏃跺璞?鍙沖?涓婏紝鑰屽乏鍊煎紩鐢ㄤ笉鍙互銆備緥濡傦細(xì) </p> <div style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; PADDING-BOTTOM: 4px; PADDING-LEFT: 5.4pt; WIDTH: 98%; PADDING-RIGHT: 5.4pt; BACKGROUND: #e6e6e6; WORD-BREAK: break-all; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid; PADDING-TOP: 4px"> <div><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000"> a_lvref </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">();      </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">error</span><span style="COLOR: #000000"> C2440: </span><span style="COLOR: #008000">'</span><span style="COLOR: #008000">initializing' : cannot convert from 'int' to 'int &'    </span><span style="COLOR: #008000"><br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000"> b_rvref </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">();  </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> OK!</span></div> </div> <p>  鍦ㄧ涓琛屼唬鐮佷腑錛屾垜浠皢涓涓復(fù)鏃跺璞nt()緇戝畾鍒頒竴涓乏鍊煎紩鐢紝灝嗕駭鐢熶竴涓紪璇戦敊璇傝屽湪絎簩琛屼腑錛屾垜浠皢涓存椂瀵硅薄緇戝畾鍒板彸鍊煎紩鐢紝灝卞彲浠ラ『鍒╅氳繃緙栬瘧銆?br><br>  鍙沖兼槸鏃犲悕鐨勬暟鎹紝渚嬪鍑芥暟鐨勮繑鍥炲間竴鑸鏉ュ氨鏄彸鍊箋傚綋瀵瑰彸鍊艱繘琛屾搷浣滅殑鏃跺欙紝鍙沖兼湰韜線寰娌℃湁蹇呰淇濈暀錛屽洜姝ゅ湪鏌愪簺鎯呭喌涓嬪彲浠ョ洿鎺?#8220;縐誨姩”涔嬨傞氳繃鍙沖煎紩鐢紝紼嬪簭鍙互鏄庣‘鐨勫尯鍒嗗嚭浼犲叆鐨勫弬鏁版槸鍚︿負(fù)鍙沖鹼紝浠庤岄伩鍏嶄簡(jiǎn)涓嶅繀瑕佺殑鎷瘋礉錛岀▼搴忕殑鏁堢巼涔熷氨寰楀埌浜?jiǎn)鎻愰珮銆傛垜浠冭檻涓涓畝鍗曠殑鏁版嵁浜ゆ崲鐨勫皬紼嬪簭錛屼粠涓潵浣撲細(xì)鍙沖煎紩鐢ㄦ墍甯︽潵鐨勬晥鐜囨彁鍗囥傛垜浠彲浠ュ啓涓涓嚱鏁皊wap鏉ュ疄鐜頒袱涓彉閲忓肩殑浜ゆ崲錛?/p> <div style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; PADDING-BOTTOM: 4px; PADDING-LEFT: 5.4pt; WIDTH: 98%; PADDING-RIGHT: 5.4pt; BACKGROUND: #e6e6e6; WORD-BREAK: break-all; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid; PADDING-TOP: 4px"> <div><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: #000000">template </span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> T</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> swap(T</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000"> a, T</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000"> b)<br>{<br>    T tmp(a);   </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> tmp瀵硅薄鍒涘緩鍚庯紝鎴戜滑灝辨嫢鏈変簡(jiǎn)a鐨勪袱浠芥嫹璐?br>    a </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> b;      </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> 鐜板湪鎴戜滑鎷ユ湁b鐨勪袱浠芥嫹璐?br>    b </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> tmp;    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> 鐜板湪鎴戜滑鎷ユ湁a鐨勪袱浠芥嫹璐?br>}</span></div> </div> <p>  鍦ㄨ繖孌典唬鐮佷腑錛岃櫧鐒舵垜浠彧鏄負(fù)浜?jiǎn)杩涜绠鍗曠殑鏁版嵁浜ゆ崲錛屼絾鏄嵈鎵ц浜?jiǎn)澶殝啤瀵硅薄鎷疯礉銆傝繖浜涘璞$殑鎷瘋礉鎿嶄綔錛岀壒鍒槸褰撹繖浜涘璞℃瘮杈冨ぇ鐨勬椂鍊欙紝鏃犵枒浼?xì)濯?jiǎng)鍝嶇▼搴忕殑鏁堢巼銆?br><br>  閭d箞錛屽鏋滀嬌鐢ㄥ彸鍊煎紩鐢ㄥ浣曞疄鐜板憿錛?/p> <div style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; PADDING-BOTTOM: 4px; PADDING-LEFT: 5.4pt; WIDTH: 98%; PADDING-RIGHT: 5.4pt; BACKGROUND: #e6e6e6; WORD-BREAK: break-all; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid; PADDING-TOP: 4px"> <div><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> RValueRef.cpp : Defines the entry point </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> the console application.<br></span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br><br>#include </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">stdafx.h</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000"><br><br>template </span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> T</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> <br>T</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000"> move(T</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000"> a)<br>{<br>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> a;<br>}<br><br>template </span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> T</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> void swap(T</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000"> a, T</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000"> b)<br>{<br>    T tmp(move(a)); </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> 瀵硅薄a琚Щ鍔ㄥ埌瀵硅薄tmp錛宎琚竻絀?br>    a </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> move(b);    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> 瀵硅薄b琚Щ鍔ㄥ埌瀵硅薄a錛宐琚竻絀?br>    b </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> move(tmp);  </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> 瀵硅薄tmp琚Щ鍔ㄥ埌瀵硅薄b<br>}<br><br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> _tmain(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, _TCHAR</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> argv[])<br>{<br>    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> a </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">1</span><span style="COLOR: #000000">;<br>    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> b </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">2</span><span style="COLOR: #000000">;<br>    swap(a, b);<br><br>   </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #800080">0</span><span style="COLOR: #000000">;<br>}</span></div> </div> <p>  鍦ㄨ繖孌甸噸鏂板疄鐜扮殑浠g爜涓紝鎴戜滑浣跨敤浜?jiǎn)涓涓猰ove()鍑芥暟鏉ヤ唬鏇垮璞$殑璧嬪兼搷浣滅“=”,move()鍙槸綆鍗曞湴鎺ュ彈涓涓彸鍊煎紩鐢ㄦ垨鑰呭乏鍊煎紩鐢ㄤ綔涓哄弬鏁幫紝鐒跺悗鐩存帴榪斿洖鐩稿簲瀵硅薄鐨勫彸鍊煎紩鐢ㄣ傝繖涓榪囩▼涓嶄細(xì)浜х敓鎷瘋礉(Copy)鎿嶄綔錛岃屽彧浼?xì)灏嗘簮瀵硅薄绉诲?Move)鍒扮洰鏍囧璞°?br><br>  姝f槸鎷瘋礉(Copy)鍜岀Щ鍔?Move)鐨勫樊鍒紝浣垮緱鍙沖煎紩鐢ㄦ垚涓篊++0x涓渶嬋鍔ㄤ漢蹇?jī)鐨勬柊鐗规т箣涓銆備粠瀹炶返瑙掑害璁詫紝瀹冭兘澶熷畬緹庢槸瑙e喅C++涓暱涔呬互鏉ヤ負(fù)浜烘墍璇熺梾鐨勪復(fù)鏃跺璞$殑鏁堢巼闂銆備粠璇█鏈韓璁詫紝瀹冨仴鍏ㄤ簡(jiǎn)C++涓殑寮曠敤綾誨瀷鍦ㄥ乏鍊煎彸鍊兼柟闈㈢殑緙洪櫡銆備粠搴撹璁¤呯殑瑙掑害璁詫紝瀹冪粰搴撹璁¤呭張甯︽潵浜?jiǎn)涓鎶婂埄鍣ㄣ傝屽浜庡箍澶х殑搴撲嬌鐢ㄨ呰岃█錛屼笉鍔ㄤ竴鍏典竴鍗掍究鑳藉鑾峰緱“鍏嶈垂鐨?#8221;鏁堢巼鎻愬崌銆?br><br>  鍦╒isual Studio 2010涓紝鍥犱負(fù)鏈変簡(jiǎn)瀵硅繖浜汣++0x鏂扮壒鎬х殑鏀寔錛岄噸鏂扮偣鐕冧簡(jiǎn)紼嬪簭鍛樹(shù)滑瀵笴++鐨勭儹鎯呫侰++閲嶆尟闆勯錛屾寚鏃ュ彲寰咃紒</p> <img src ="http://www.shnenglu.com/kyline/aggbug/81217.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/kyline/" target="_blank">璋蜂富</a> 2009-04-27 16:02 <a href="http://www.shnenglu.com/kyline/archive/2009/04/27/81217.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鐩存帴鐨刅S 2005 榪滅▼璋冭瘯http://www.shnenglu.com/kyline/archive/2009/04/23/80821.html璋蜂富璋蜂富Thu, 23 Apr 2009 03:34:00 GMThttp://www.shnenglu.com/kyline/archive/2009/04/23/80821.htmlhttp://www.shnenglu.com/kyline/comments/80821.htmlhttp://www.shnenglu.com/kyline/archive/2009/04/23/80821.html#Feedback1http://www.shnenglu.com/kyline/comments/commentRss/80821.htmlhttp://www.shnenglu.com/kyline/services/trackbacks/80821.htmlVS2005涓繙紼嬭皟璇曠殑閰嶇疆鏂規(guī)硶
鍦╒S2005涓笉鑳戒嬌鐢╒S2003鐨勮繙紼嬭皟璇曠▼搴忋俈S2005榪滅▼璋冭瘯鐨勬柟娉曪細(xì)
(1) 榪滅▼绔細(xì)瀹夎VS2005鍏夌洏"X:\vs\Remote Debugger\x86\ rdbgsetup.exe"銆傛垨鑰呯洿鎺ヨ繍琛屾垨copy鏈湴绔殑錛?"Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x86"
(2) 榪滅▼绔細(xì)“鏈湴瀹夊叏絳栫暐 錛?瀹夊叏閫夐」 錛?緗戠粶璁塊棶錛氭湰鍦板笎鎴風(fēng)殑鍏變韓鍜屽畨鍏ㄦā寮?#8221;鏀逛負(fù)錛氱粡鍏革紞鏈湴鐢ㄦ埛浠ヨ嚜宸辯殑韜喚楠岃瘉銆?br>(3) 榪滅▼绔細(xì)鍚姩Remote Debuger錛屼粠“宸ュ叿 錛?閫夐」”涓皢韜喚楠岃瘉妯″紡鏀逛負(fù)“鏃犺韓浠介獙璇侊紝鍏佽浠諱綍鐢ㄦ埛榪涜璋冭瘯”銆?br>鎴栬呯洿鎺ョ敤鍛戒護(hù)琛岋細(xì)"X:\ msvsmon.exe" /noauth /anyuser /nosecuritywarn錛屽彲浠ュ緩涓揩鎹鋒柟寮忎互鏂逛究榪愯銆?br>(4) 鏈湴錛氬湪VS2005涓紝“宸ュ叿”錛嶏紞“闄勫姞鍒拌繘紼?#8221;錛屼紶杈撻?#8220;榪滅▼”錛岄檺瀹氱杈撳叆榪滅▼绔殑涓繪満鍚嶆垨IP鍦板潃錛屽洖杞︼紝緇堜簬鍑烘潵浜?jiǎn)鍙堔q殑榪涚▼鍒楄〃銆?br>灝忕粨錛氳窡VS2003鐩告瘮錛?005鐨勮繙紼嬭皟璇曠殑閰嶇疆瑕佺◢楹葷儲(chǔ)涓浜涳紝涓嶈繃鏈変竴鐐歸噸瑕佺殑榪涙鏄畠鍙互閰嶇疆鎴愭湇鍔★紝涓嶅儚鍦?003涓嬮潰瑕佸仛綣佺悙鐨勬墜宸ラ厤緗?/div>

鏁撮偅涔堝閮芥病鏈夋病鏈夌敤鐨勶紒

璋蜂富 2009-04-23 11:34 鍙戣〃璇勮
]]>GDI+緇樺浘http://www.shnenglu.com/kyline/archive/2009/04/10/79513.html璋蜂富璋蜂富Fri, 10 Apr 2009 07:54:00 GMThttp://www.shnenglu.com/kyline/archive/2009/04/10/79513.htmlhttp://www.shnenglu.com/kyline/comments/79513.htmlhttp://www.shnenglu.com/kyline/archive/2009/04/10/79513.html#Feedback1http://www.shnenglu.com/kyline/comments/commentRss/79513.htmlhttp://www.shnenglu.com/kyline/services/trackbacks/79513.htmlGraphics    graphics(hdc);
    GraphicsPath path;
    
    LinearGradientBrush linGrBrushB(
        Point(
070),
        Point(
14070),
        Color(
255000),   // opaque red
        Color(2552550255));  // opaque blue

    LinearGradientBrush linGrBrushF(
        Point(
2070),
        Point(
12070),
        Color(
2552550255),   // opaque red
        Color(255000));  // opaque blue
    graphics.FillEllipse(&linGrBrushB, 00140140);
    graphics.FillEllipse(
&linGrBrushF, 2020100100);
    
//Play
    SolidBrush  brush(Color(25500255));
   FontFamily  fontFamily(L
"Times New Roman");
   Font        font(
&fontFamily, 24, FontStyleRegular, UnitPixel);
   PointF      pointF(
49.0f58.0f);

    graphics.DrawString(L
"Play",-1,&font, pointF, &brush);


璋蜂富 2009-04-10 15:54 鍙戣〃璇勮
]]>
How To Play a File use DirectShow?http://www.shnenglu.com/kyline/archive/2009/04/09/79325.html璋蜂富璋蜂富Thu, 09 Apr 2009 02:26:00 GMThttp://www.shnenglu.com/kyline/archive/2009/04/09/79325.htmlhttp://www.shnenglu.com/kyline/comments/79325.htmlhttp://www.shnenglu.com/kyline/archive/2009/04/09/79325.html#Feedback0http://www.shnenglu.com/kyline/comments/commentRss/79325.htmlhttp://www.shnenglu.com/kyline/services/trackbacks/79325.htmlDirectShow application always performs the same basic steps:
  1. Create an instance of the Filter Graph Manager.
  2. Use the Filter Graph Manager to build a filter graph.
  3. Run the graph, causing data to move through the filters.

Start by calling CoInitialize to initialize the COM library:

HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
// Add error-handling code here. (Omitted for clarity.)
}

To keep things simple, this example ignores the return value, but you should always check the HRESULT value from any method call.

Next, call CoCreateInstance to create the Filter Graph Manager:

IGraphBuilder *pGraph;
HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL,
CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);

As shown, the class identifier (CLSID) is CLSID_FilterGraph. The Filter Graph Manager is provided by an in-process DLL, so the execution context is CLSCTX_INPROC_SERVER. DirectShow supports the free-threading model, so you can also call CoInitializeEx with the COINIT_MULTITHREADED flag.

The call to CoCreateInstance returns the IGraphBuilder interface, which mostly contains methods for building the filter graph. Two other interfaces are needed for this example:

  • IMediaControl controls streaming. It contains methods for stopping and starting the graph.
  • IMediaEvent has methods for getting events from the Filter Graph Manager. In this example, the interface is used to wait for playback to complete.

Both of these interfaces are exposed by the Filter Graph Manager. Use the returned IGraphBuilder pointer to query for them:

IMediaControl *pControl;
IMediaEvent   *pEvent;
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);

Now you can build the filter graph. For file playback, this is done by a single method call:

hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);

The IGraphBuilder::RenderFile method builds a filter graph that can play the specified file. The first parameter is the file name, represented as a wide character (2-byte) string. The second parameter is reserved and must equal NULL.

This method can fail if the specified file does not exist, or the file format is not recognized. Assuming that the method succeeds, however, the filter graph is now ready for playback. To run the graph, call the IMediaControl::Run method:

hr = pControl->Run();

When the filter graph runs, data moves through the filters and is rendered as video and audio. Playback occurs on a separate thread. You can wait for playback to complete by calling the IMediaEvent::WaitForCompletion method:

long evCode = 0;
pEvent->WaitForCompletion(INFINITE, &evCode);

This method blocks until the file is done playing, or until the specified time-out interval elapses. The value INFINITE means the application blocks indefinitely until the file is done playing. For a more realistic example of event handling, see Responding to Events.

When the application is finished, release the interface pointers and close the COM library:

pControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize();

Sample Code

Here is the complete code for the example described in this article:



#include 
<dshow.h>
void main(void)
{
    IGraphBuilder 
*pGraph = NULL;
    IMediaControl 
*pControl = NULL;
    IMediaEvent   
*pEvent = NULL;

    
// Initialize the COM library.
    HRESULT hr = CoInitialize(NULL);
    
if (FAILED(hr))
    
{
        printf(
"ERROR - Could not initialize COM library");
        
return;
    }


    
// Create the filter graph manager and query for interfaces.
    hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, 
                        IID_IGraphBuilder, (
void **)&pGraph);
    
if (FAILED(hr))
    
{
        printf(
"ERROR - Could not create the Filter Graph Manager.");
        
return;
    }


    hr 
= pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
    hr 
= pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);

    
// Build the graph. IMPORTANT: Change this string to a file on your system.
    hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);
    
if (SUCCEEDED(hr))
    
{
        
// Run the graph.
        hr = pControl->Run();
        
if (SUCCEEDED(hr))
        
{
            
// Wait for completion.
            long evCode;
            pEvent
->WaitForCompletion(INFINITE, &evCode);

            
// Note: Do not use INFINITE in a real application, because it
            
// can block indefinitely.
        }

    }

    pControl
->Release();
    pEvent
->Release();
    pGraph
->Release();
    CoUninitialize();
}





璋蜂富 2009-04-09 10:26 鍙戣〃璇勮
]]>
鍝堝搱錛屽揩瑕佽冪爺浜?/title><link>http://www.shnenglu.com/kyline/archive/2009/04/09/79319.html</link><dc:creator>璋蜂富</dc:creator><author>璋蜂富</author><pubDate>Thu, 09 Apr 2009 01:44:00 GMT</pubDate><guid>http://www.shnenglu.com/kyline/archive/2009/04/09/79319.html</guid><wfw:comment>http://www.shnenglu.com/kyline/comments/79319.html</wfw:comment><comments>http://www.shnenglu.com/kyline/archive/2009/04/09/79319.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/kyline/comments/commentRss/79319.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/kyline/services/trackbacks/79319.html</trackback:ping><description><![CDATA[閮藉揩琚珮鏂叕寮忔悶姝諱簡(jiǎn)!! <img src ="http://www.shnenglu.com/kyline/aggbug/79319.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/kyline/" target="_blank">璋蜂富</a> 2009-04-09 09:44 <a href="http://www.shnenglu.com/kyline/archive/2009/04/09/79319.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.gdguangjie.cn" target="_blank">精品多毛少妇人妻AV免费久久</a>| <a href="http://www.lepinw.cn" target="_blank">亚洲国产另类久久久精品</a>| <a href="http://www.iaicy.cn" target="_blank">亚洲精品tv久久久久久久久</a>| <a href="http://www.bpdb.com.cn" target="_blank">国产精品日韩欧美久久综合</a>| <a href="http://www.b3382.cn" target="_blank">狠狠色婷婷综合天天久久丁香 </a>| <a href="http://www.sccdseo.cn" target="_blank">久久久久久久久久久久中文字幕</a>| <a href="http://www.1758c.cn" target="_blank">久久天天日天天操综合伊人av</a>| <a href="http://www.mmexse.cn" target="_blank">丰满少妇人妻久久久久久4</a>| <a href="http://www.fm935.cn" target="_blank">91精品国产综合久久婷婷</a>| <a href="http://www.beo.net.cn" target="_blank">久久青青草原精品国产</a>| <a href="http://www.gnkk.net.cn" target="_blank">无码精品久久久久久人妻中字</a>| <a href="http://www.wthangjia.cn" target="_blank">性色欲网站人妻丰满中文久久不卡</a>| <a href="http://www.luluw.cn" target="_blank">久久亚洲精品国产亚洲老地址</a>| <a href="http://www.6998bar.cn" target="_blank">久久综合久久综合亚洲</a>| <a href="http://www.wuyezizhi.cn" target="_blank">久久亚洲精品国产精品婷婷</a>| <a href="http://www.265zz.cn" target="_blank">久久精品青青草原伊人</a>| <a href="http://www.ccssoo.com.cn" target="_blank">久久AV无码精品人妻糸列</a>| <a href="http://www.material7.cn" target="_blank">久久www免费人成看片</a>| <a href="http://www.toy365.cn" target="_blank">久久国产精品一国产精品金尊</a>| <a href="http://www.fzmnls.cn" target="_blank">99精品国产在热久久</a>| <a href="http://www.cxdsj.net.cn" target="_blank">亚洲国产成人久久精品动漫</a>| <a href="http://www.tgbnews.cn" target="_blank">国产精品99久久久久久www</a>| <a href="http://www.shxxwxx.cn" target="_blank">久久久久香蕉视频</a>| <a href="http://www.qlmoban.cn" target="_blank">久久亚洲AV无码精品色午夜 </a>| <a href="http://www.xwgqzp.cn" target="_blank">亚洲AV无码久久精品蜜桃</a>| <a href="http://www.0513act.cn" target="_blank">中文字幕人妻色偷偷久久</a>| <a href="http://www.sharelib.cn" target="_blank">日产精品久久久久久久</a>| <a href="http://www.x3077.cn" target="_blank">久久91精品国产91久久户</a>| <a href="http://www.verywin.cn" target="_blank">久久久久无码中</a>| <a href="http://www.tr78.cn" target="_blank">亚洲精品美女久久久久99</a>| <a href="http://www.todd3015.cn" target="_blank">99久久99久久</a>| <a href="http://www.buniaowan.cn" target="_blank">久久九九免费高清视频 </a>| <a href="http://www.2vc80.cn" target="_blank">久久精品aⅴ无码中文字字幕不卡</a>| <a href="http://www.riseguide.com.cn" target="_blank">2021久久精品免费观看</a>| <a href="http://www.sjz114.net.cn" target="_blank">久久综合给合久久狠狠狠97色69</a>| <a href="http://www.vmtkcxf.cn" target="_blank">久久久久久免费一区二区三区 </a>| <a href="http://www.hwaq.cn" target="_blank">久久久噜噜噜久久中文字幕色伊伊</a>| <a href="http://www.weryuadfsd.cn" target="_blank">日本亚洲色大成网站WWW久久 </a>| <a href="http://www.sheersky.cn" target="_blank">久久国产精品无码一区二区三区</a>| <a href="http://www.hy-exp.cn" target="_blank">88久久精品无码一区二区毛片 </a>| <a href="http://www.dyhotel.com.cn" target="_blank">狠狠久久亚洲欧美专区</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>