亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? string_discussion.html

?? ISO_C++:C++_STL開發文檔
?? HTML
字號:
<!DOCTYPE HTML PUBLIC "-//Netscape Comm. Corp.//DTD HTML//EN"><!--  -- Copyright (c) 1996-1999  -- Silicon Graphics Computer Systems, Inc.  --  -- Permission to use, copy, modify, distribute and sell this software  -- and its documentation for any purpose is hereby granted without fee,  -- provided that the above copyright notice appears in all copies and  -- that both that copyright notice and this permission notice appear  -- in supporting documentation.  Silicon Graphics makes no  -- representations about the suitability of this software for any  -- purpose.  It is provided "as is" without express or implied warranty.  --  -- Copyright (c) 1994  -- Hewlett-Packard Company  --  -- Permission to use, copy, modify, distribute and sell this software  -- and its documentation for any purpose is hereby granted without fee,  -- provided that the above copyright notice appears in all copies and  -- that both that copyright notice and this permission notice appear  -- in supporting documentation.  Hewlett-Packard Company makes no  -- representations about the suitability of this software for any  -- purpose.  It is provided "as is" without express or implied warranty.  --  --><HTML><HEAD>    <TITLE> Strings in SGI STL</TITLE></HEAD><BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" ALINK="#ff0000"> <IMG SRC="CorpID.gif"      ALT="SGI" HEIGHT="43" WIDTH="151"> <!--end header--><H1>Strings in SGI STL </H1>This is an attempt to answer some of the questions related to the useof strings with SGI STL.<H2>What's wrong with the string class defined by the draft standard?</h2>There are several problems, but the most serious ones relate to thespecification for lifetimes of references to characters in a string.The second committee draft disallows the expression<NOBR><SAMP>s[1] == s[2]</samp></nobr>where s is a nonconstantstring.  This is not simply an oversight; current reference countedimplementations may fail for more complicated examples.  They may fail evenfor <NOBR><SAMP>s[1] == s[2]</samp></nobr> if the string <samp>s</samp> issimultaneously examined (merely examined, not necessarily modified) byanother thread.  It is hard to define precisely what constitutes acorrect use of one of the current reference counted implementation.<P>This problem was partially addressed at the July 1997 meeting of theC++ standardization committee; the solution was to adopt morecomplicated rules about reference lifetimes.  Unfortunately, these newrules still do not address the multi-threading issues.<P>A related problem was pointed out in the French national body commentson the second committee draft.  The following program produces thewrong answer for most reference counted <tt>basic_string</tt>implementations that we have tested; the problem is that, if twostrings share a common representation, they are vulnerable tomodification through a pre-existing reference or iterator.<PRE># include &ltstring&gt# include &ltstdio.h&gtmain() {   string s("abc");   string t;   char &amp c(s[1]);   t = s;	// Data typically shared between s and t.   c = 'z';     // How many strings does this modify?   if (t[1] == 'z') {        printf("wrong\n");   } else {        printf("right\n");   }}</pre><P>The draft standard (as well as common sense) says that updating areference to one of <tt>s</tt>'s elements should only modify<tt>s</tt>, not <tt>t</tt> as well; the fact that <tt>s</tt> and<tt>t</tt> might share a representation is an implementation detailthat should have no effect on program behavior.  Given the design of<tt>basic_string</tt>, though, it is very difficult for areference-counted implementation to satisfy that requirement.<P>The only known way for a reference-counted implementation to avoidthis problem is to mark a string as unsharable whenever there might bean existing reference or iterator to that string.  That is, whenever aprogram obtains a reference or an iterator to a string (<I>e.g.</i> byusing <TT>operator[]</tt> or <tt>begin()</tt>), that particular stringwill no longer use reference counting; assignment and copyconstruction will copy the string's elements instead of just copying apointer.  (We are not aware of any implementation that uses this technique and that also attempts to be thread-safe.)<p>This is a drastic solution: since almost all ways of referring tocharacters involve references or iterators, this solution implies, ineffect, that the only strings that can be reference-counted are theones that are never used.  In practice, then, a reference countedimplementation of <tt>basic_string</tt> can't achieve the performancegains that one might otherwise expect, since reference counting isforbidden in all but a few special cases.<P>A different solution is to abandon the goal of reference-countedstrings altogether, and to provide a non-reference-countedimplementation of <TT>basic_string</tt> instead.  The draft standardpermits non-reference-counted implementations, and several vendorsalready provide them.  The performance characteristicsof a non-reference-counted <TT>basic_string</tt> are predicable,and are very similar to those of a <TT>vector&ltchar&gt</tt>: copying a string, for example, is always an <i>O(N)</i>operation.<P>In this implementation, <A href="basic_string.html">basic_string</A>does not use reference counting.<H2>I have been using a reference counted implementation, and it works fine.Why haven't I seen problems?</h2>The current implementations do work correctly, most of the time:preserving a reference to a character in a string is uncommon.(Although preserving iterators to strings may be more frequent, andexactly the same issues apply to iterators.)  Some less contrivedsequential programs also fail, though, or else behave differently ondifferent platforms.  <P>Multi-threaded applications that use a reference counted<tt>basic_string</tt> are likely to fail intermittently, perhaps onceevery few months; these intermittent failures are difficult toreproduce and debug.  But it is likely that a large fraction ofmulti-threaded clients will fail occasionally, thus making such alibrary completely inappropriate for multi-threaded use.<H2>So what should I use to represent strings?</h2>There are several possible options, which are appropriate under differentcircumstances:<DL><DT><B><A HREF="Rope.html">Ropes</A></b><DD>Use the <TT><A HREF="Rope.html">rope</A></TT> package provided by theSGI STL.  This provides all functionality that's likely to be needed.Its interface is similar to the current draft standard, but differentenough to allow a correct and thread-safe implementation.  It shouldperform reasonably well for all applications that do not require veryfrequent small updates to strings.  It is the only alternative thatscales well to very long strings, <i>i.e.</i> that could easily be used torepresent a mail message or a text file as a single string.<P>The disadvantages are:<UL><LI> Single character replacements are slow.  Consequently STL algorithmsare likely to be slow when updating ropes.  (Insertions near the beginningtake roughly the same amount of time as single character replacements, andmuch less time than corresponding insertions for the other stringalternatives.)<LI>The <TT><A HREF="Rope.html">rope</A></TT> implementation stretchescurrent compiler technology.  Portability and compilation time may bean issue in the short term.  Pthread performance on non-SGI platformswill be an issue until someone provides machine-specific fastreference counting code.  (This is also likely to be an issue forother reference counted implementations.)</ul><DT><B>C strings</b><DD>This is likely to be the most efficient way to represent a largecollection of very short strings.  It is by far the most spaceefficient alternative for small strings.  For short strings, the Clibrary functions in <tt>&lt;string.h&gt;</tt> provide an efficient set oftools for manipulating such strings.  They allow easy communicationwith the C library.  The primary disadvantages are that<UL><LI> Operations such as concatenation and substring are much moreexpensive than for <TT><A HREF="Rope.html">ropes</A></TT> if thestrings are long.  A C string is not a good representation for a textfile in an editor.<LI> The user needs to be aware of sharing between string representations.If strings are assigned by copying pointers, an update to one string mayaffect another.<LI>C strings provide no help in storage management.  This may be amajor issue, although a garbage collector can help alleviate it.</ul><DT><B><A Href="Vector.html">vector</A>&lt;char&gt;</b><DD>If a string is treated primarily as an array of characters, withfrequent in-place updates, it is reasonable to represent it as <TT><AHref="Vector.html">vector</A>&lt;char&gt;</tt> or <TT><AHref="Vector.html">vector</A>&lt;wchar_t&gt;</tt>.  The same is trueif it will be modified by STL container algorithms.  Unlike C strings,vectors handle internal storage management automatically, andoperations that modify the length of a string are generally moreconvenient.<P>Disadvantages are:<UL><LI>Vector assignments are much more expensive than C string pointerassignments; the only way to share string representations is to passpointers or references to vectors.<LI>Most operations on entire strings (<I>e.g.</i> assignment, concatenation)do not scale well to long strings.<LI>A number of standard string operations (<I>e.g.</i> concatenationand substring) are not provided with the usual syntax, and must beexpressed using generic STL algorithms.  This is usually not hard.<LI>Conversion to C strings is currently slow, even for short strings.That may change in future implementations.</ul></dl><H2>What about <TT>mstring.h</tt>, as supplied with SGI's 7.1 compiler?</h2>This package was a minimal adaptation of the freely available Modenastrings package.  It was intended as a stopgap.  We do not intend to develop it further.<P>It shares some of the reference lifetime problems of otherimplementations that try to conform to the draft standard.  Its exactsemantics were never well-defined.  Under rare conditions, it willhave unexpected semantics for single-threaded applications.  It failson the example given above.  We strongly discourage use formulti-threaded applications.<!--start footer--> <HR SIZE="6"><A href="http://www.sgi.com/"><IMG SRC="surf.gif" HEIGHT="54" WIDTH="54"         ALT="[Silicon Surf]"></A><A HREF="index.html"><IMG SRC="stl_home.gif"         HEIGHT="54" WIDTH="54" ALT="[STL Home]"></A><BR><FONT SIZE="-2"><A href="http://www.sgi.com/Misc/sgi_info.html" TARGET="_top">Copyright &copy; 1999 Silicon Graphics, Inc.</A> All Rights Reserved.</FONT><FONT SIZE="-3"><a href="http://www.sgi.com/Misc/external.list.html" TARGET="_top">TrademarkInformation</A></FONT><P></BODY></HTML> 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区黄| 午夜精品久久久久久久久久| 亚洲成人www| 国产aⅴ综合色| 日韩亚洲欧美成人一区| 一区二区三区欧美在线观看| 国产 欧美在线| 欧美一区二区三区小说| 亚洲最新在线观看| 99久久精品费精品国产一区二区| 欧美一区二区在线观看| 亚洲v中文字幕| 在线观看视频一区二区 | 亚洲男人电影天堂| 国产资源精品在线观看| 777a∨成人精品桃花网| 一区二区三区小说| 91蜜桃在线免费视频| 国产精品理论片| 国产成人三级在线观看| 久久影院午夜片一区| 韩国av一区二区三区在线观看| 7777精品伊人久久久大香线蕉完整版| 亚洲欧美国产三级| 91浏览器在线视频| 亚洲欧洲日韩综合一区二区| 成人理论电影网| 国产精品久久二区二区| 久久精品理论片| 久久嫩草精品久久久精品| 国内精品伊人久久久久av一坑| 日韩一卡二卡三卡国产欧美| 麻豆精品精品国产自在97香蕉 | 日本不卡视频在线观看| 欧美日韩国产成人在线91| 午夜精品福利一区二区三区蜜桃| 97久久精品人人做人人爽50路| 一区视频在线播放| 在线看国产日韩| 日韩国产精品久久| 日韩女优毛片在线| 国产一区二区三区日韩 | 欧美一区二区在线不卡| 美国十次了思思久久精品导航| 日韩精品一区国产麻豆| 国产精选一区二区三区| 成人免费小视频| 欧美日韩亚洲丝袜制服| 强制捆绑调教一区二区| 久久久亚洲精品石原莉奈| heyzo一本久久综合| 一区二区三区美女视频| 777欧美精品| 粉嫩嫩av羞羞动漫久久久| 亚洲精品国产无天堂网2021| 欧美高清视频在线高清观看mv色露露十八 | 久久久久国产精品厨房| 成人av网站在线观看| 亚洲影视在线播放| 精品国产青草久久久久福利| 成+人+亚洲+综合天堂| 亚洲成人三级小说| 精品国产99国产精品| www.欧美色图| 免费一级欧美片在线观看| 国产亚洲欧洲997久久综合| 色狠狠一区二区三区香蕉| 日韩福利视频导航| 国产精品国产三级国产普通话蜜臀| 欧美性大战久久久久久久| 国内精品久久久久影院色| 亚洲精品国产无套在线观| 欧美成人免费网站| 色88888久久久久久影院按摩| 青青草一区二区三区| 最新国产成人在线观看| 日韩欧美激情在线| 在线观看日韩av先锋影音电影院| 精品一区二区三区影院在线午夜| 亚洲人成在线播放网站岛国| 久久综合色播五月| 国产日产欧美一区二区视频| 91国产精品成人| 成人黄页在线观看| 另类综合日韩欧美亚洲| 亚洲国产视频在线| 中文字幕一区二区三区蜜月 | 看片网站欧美日韩| 一区二区在线电影| 亚洲国产精品成人久久综合一区| 9191成人精品久久| 欧美日韩一区 二区 三区 久久精品| 国产美女主播视频一区| 免费成人美女在线观看| 亚洲高清免费观看高清完整版在线观看 | 久久精品国产精品亚洲红杏| 亚洲电影中文字幕在线观看| 中文字幕一区av| 国产喂奶挤奶一区二区三区| wwwwxxxxx欧美| 欧美不卡一二三| 日韩一区二区三区电影在线观看 | 99精品视频在线观看免费| 久久99深爱久久99精品| 日韩av网站免费在线| 亚洲一级不卡视频| 一区二区三区在线视频观看 | 蜜臀a∨国产成人精品| 午夜日韩在线观看| 午夜精品久久久久久不卡8050| 亚洲精品老司机| 亚洲激情网站免费观看| 一区二区三区高清不卡| 亚洲精品福利视频网站| 一区二区三国产精华液| 亚洲综合网站在线观看| 亚洲成人精品影院| 日本美女视频一区二区| 免费在线成人网| 精品一区二区在线视频| 国产一区美女在线| 成人午夜在线播放| 99国产一区二区三精品乱码| 99久久综合国产精品| 91黄色免费看| 欧美一区二区三区在线视频| 日韩三级视频在线看| 欧美成人激情免费网| 久久青草国产手机看片福利盒子| 2023国产一二三区日本精品2022| 久久欧美一区二区| 亚洲色图欧美偷拍| 首页综合国产亚洲丝袜| 黄色日韩网站视频| 99麻豆久久久国产精品免费| 欧美婷婷六月丁香综合色| 日韩一区二区三区精品视频| 久久精品在线观看| 一区二区三区国产精华| 免费看欧美女人艹b| 国产a区久久久| 欧美日韩国产首页在线观看| 日韩美女视频在线| 国产精品电影一区二区三区| 亚洲一区二区三区中文字幕在线| 免费看黄色91| 日韩一区二区电影| 国产精品网站在线| 日韩国产一二三区| 成人av小说网| 日韩欧美亚洲国产精品字幕久久久| 国产日本欧洲亚洲| 午夜视频在线观看一区| 国产成人在线网站| 欧美日韩成人一区| 国产精品视频观看| 日本亚洲欧美天堂免费| 99久久久久久| 精品捆绑美女sm三区| 亚洲激情一二三区| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 99久久免费视频.com| 日韩欧美亚洲国产精品字幕久久久| 国产精品久久久久久久久免费樱桃| 天天综合色天天| 91免费视频大全| 久久综合色鬼综合色| 性久久久久久久久| 97久久超碰国产精品电影| 精品毛片乱码1区2区3区| 亚洲午夜久久久| 99久久99精品久久久久久| 久久夜色精品国产噜噜av| 日韩综合小视频| 欧美色图12p| 成人欧美一区二区三区小说| 国产一区二区三区| 欧美一级爆毛片| 亚洲va在线va天堂| 91福利在线免费观看| 亚洲欧洲精品一区二区三区| 国产一区91精品张津瑜| 日韩精品一区二区三区中文精品| 亚洲一卡二卡三卡四卡五卡| 91麻豆国产精品久久| 国产精品美女久久久久久久久| 国产一区二区福利视频| 欧美tk—视频vk| 六月丁香婷婷色狠狠久久| 欧美一区二区私人影院日本| 午夜电影网一区| 欧美日韩国产一二三| 亚洲国产精品一区二区www在线| 日本韩国精品在线| 亚洲色图一区二区| 色一情一伦一子一伦一区| 亚洲精品乱码久久久久| 91国产免费观看| 午夜欧美大尺度福利影院在线看| 欧美日韩亚洲高清一区二区|