vector 㯠vector ã«å¯¾ãã¦ç¹æ®åããã¦ãã¦ãé åãç¡é§ã«ããªãããã«ããããåä½ã§æ ¼ç´ãããããã«ãªã£ã¦ãã¾ãã ããã¯ä½¿ç¨ããé åãå°ãªããªãåé¢ã &v[0]+i == &v[i] ã§ããã¨ãããvector ã¨ãã¦ã®ç¹å¾´ã®ä¸ã¤ãæºãããªããªã£ã¦ãã¾ãã¾ãã ä»ã«ãããã¤ããbool 以å¤ã® vector ã¨ç°ãªãåä½ãããç®æãããã¾ãã ãã®ãããTwitter ãæ²ç¤ºæ¿ç㧠vector ã®è©±ãåºããã³ã«å¿ ãã¨ãã£ã¦ããã»ã©ãããã¯ä½¿ããªã失æä½ã ãã¨ããããã¯ããå¿ãããã¨ãã趣æ¨ã®çºè¨ãè¦ããã¾ãã ãããã£ãå ´é¢ã«ééãããã³ã«èªåã¯å¾®å¦ãªæ°åã«ãªãã¾ãã å®éã®ã¨ãããã大éã®ããããæ ¼ç´ãããããã©ãã¡ã¢ãªãç¡é§ã«ããããªããã¨ããç¶æ³ããã*1ã¨ããvector 以å¤ã®é¸æè¢ã¯ã©ã®ç¨åº¦ãããã§ããããï¼ ã¾ãèªåã§ä½ãã¨ããé¸æè¢ãããã¯ã»ã¨ãã©ã®å ´åã¯
C++0x ã® std::vector ã«ã¯ãæ°ãã shrink_to_fit() ã¡ã³ãé¢æ°ãç¨æããã¦ãã¾ãã ããã¯ã vector ã®ç¢ºä¿ãã¦ããã¡ã¢ãªé åãããã®å¤§ããã«è¦åã£ããµã¤ãºã¾ã§ç¸®å°ãããé¢æ°ã§ã å ¸åçãªä½¿ãæ¹ã¯ã以ä¸ã®ãããªæãã«ãªãã¾ãï¼ // std::vector ã«æ ¼ç´ãããè¦ç´ æ°ã®è¦å½ãã¤ããããªã // ãããä¸éãã¯åããããã®ã¨ãä½è¨ãªé åã®å確ä¿ãé¿ããã std::size_t const limit = ãã; // vector ã«æ ¼ç´ãããè¦ç´ ã®ä¸é std::vector<T> vec; // ã¾ãä¸éã¾ã§ã¡ã¢ãªé åã確ä¿ãã vec.reserve( limit ); // vec ã«æ ¼ç´ãã¦ãã // ... // æ ¼ç´çµäºããããã // ãã®ã¾ã¾ã ã¨å·¨å¤§ãªã¡ã¢ãªé åãå æãã¦ãã¾ãã®ã§ã // vec ã®ç¢ºä¿ãã¦ããé åãã s
C++ å¯ç¨¿è¨äº εÏιÏÏημη æ°ããå¯ç¨¿ãã¦ããã ãããéçºè ã®æ¹ã ã«ãå½¹ã«ç«ã¤ãã¯ãã«ã«ããã¥ã¡ã³ãã§ããArticlesãReferencesãMiscelaneousã«åããã¦èª¬æãã¦ãã¾ããåå¿è ã®æ¹ããããã®æ¹ã¾ã§å½¹ã«ç«ã¤èªã¿ç©ã¨è³æéã§ããæ¯éãéçºã®ãå½¹ã«ãç«ã¦ä¸ããã Articles: èªã¿ç© References: è³æé Miscelaneous: çªå¤ç·¨
1985å¹´ãAT&Tã®Bjarne StroustrupãC++ããã®ä¸ã«éãåºãã¾ããããã®å¾C++ã¯æ§ã ãªæ¡å¼µãç¹°ãè¿ããªããé²åãã¦ãã¾ããã 1991å¹´ãISOã¯C++ã®å½éæ¨æº(standard C++)ãå®ããä½æ¥ãéå§ãã¾ãããæ¨æºC++ã®æçµèæ¡ã¯1997å¹´ã«ISO C++æ¨æºåå§å¡ä¼ã«æ¿èªããã¾ããã æ¨æºC++ãè¦å®ããã®ã¯è¨èªä»æ§ã ããªããC++æ¨æºã©ã¤ãã©ãªãè¦æ ¼ã®ä¸ã§æ確ã«å®ãããã¦ãã¾ããããã¾ã§C++ã®ã©ã¤ãã©ãªã¨ããã°iostreamãããã®ãã®ã§ãããããããããã¾ã§"äºå®ä¸ã®æ¨æº"ã§ããããã¾ããã§ããã ããã¦ãã®C++æ¨æºã©ã¤ãã©ãªã®ä¸é¨ã¨ãã¦çµã¿å ¥ããããã®ãSTL(Standard Template Library)ã§ããããªãã¡STLã¯æ¨æºC++ã®ä»æ§ã®ä¸é¨ã¨ãããã¨ã§ãã åãSTLãç¥ã£ãã®ã¯1995å¹´ãããã¤ãã®ã³ã³ãã¤ã©ãtemplat
ãã®ãã¡ã¤ã³ã¯ ãåå.com ããåå¾ããã¾ããã ãåå.com 㯠GMOã¤ã³ã¿ã¼ãããã°ã«ã¼ã(æ ª) ãéå¶ããå½å ã·ã§ã¢No.1ã®ãã¡ã¤ã³ç»é²ãµã¼ãã¹ã§ãã â»è¡¨ç¤ºä¾¡æ ¼ã¯ãå ¨ã¦ç¨è¾¼ã§ãã â»ãµã¼ãã¹å質ç¶æã®ãããä¸æçã«å¯¾è±¡ã¨ãªãæéã¸ä¸å®å²åã®ããµã¼ãã¹ç¶æ調æ´è²»ããå ç®ããã¦ããã ãã¾ãã
以ä¸ã®ã³ã¼ãã®ããã«ãã³ãã¼(Move)ããauto_ptrã®element_typeãç°ãªãã¨operator auto_ptr_ref<_Other>()ãç¡éã«å帰ãã¦ã¹ã¿ãã¯ãã¨ã¶ ã©ããauto_ptr_refã®ã³ãã¼ã³ã³ã¹ãã©ã¯ã¿ãå¼ã¶ããã«åã³ãããå¼ã°ããããã ã³ã³ãã¤ã©ã®ãã°ã§ã¯ãªãSTLã®ãã°ã¨æããã VC8ä»å±ã®ãã®ã¯ç´ã£ã¦ãã []#include[] []<memory>[] []// auto_ptr[] []std[][]::[][]auto_ptr[][]<[][]int[][]> [][]new_int[][]()[] []{[] []return[] []std[][]::[][]auto_ptr[][]<[][]int[][]>([][]new[] []int[][]());[] []}[] []void[] []test[][]()[] []{[
ã¯ããã«ããã®è¨äºã®ç®çã¯ããC++ã®STLã«ã¯ãã¼ã¿ãã½ã¼ãããæ¹æ³ãããã¤ãåå¨ããããã½ã¼ãå¦çãç°¡åã«ããã¤å¹çã®ããã³ã¼ãã¯ã©ããâ¦ãã調ã¹ããã¨ã§ãããããã§ã¯ãèªåã®ã½ã¼ãã¢ã«ã´ãªãºã ãä½ã£ã¦é度ãæ¯è¼ããããæ¢åã®ã½ã¼ãã¢ã«ã´ãªãºã ãæé©åããã¨ãã£ããã¨ã¯ç®çã¨ãã¾ãããå ¬éããã¦ããSTLãããã®ã¾ã¾ã®å§¿ã§è¨æ¸¬ãã¾ããã³ã¼ãã®ä¿å®æ§ã移æ¤æ§ãå¯èªæ§ãèæ ®ãã¦ãããã£ã¦æ®éããªæ¸ãæ¹ãä¸çªã¡ãªãããåããããã¨èãã¦ãã¾ãããããå¤ãã®äººã«æ©æµãããããã¨èããããã§ãããèªåã®ã½ã¼ãã¢ã«ã´ãªãºã ã®æ§ç¯ããæ¢åã®ã¢ã«ã´ãªãºã ã®æé©åã¯ãå¯èªæ§ã移æ¤æ§ãæªããããããå¾ãããã¡ãªããï¼é«éå¦çã«ããæéï¼ããããã¡ãªããã大ããã¨èãã¦ããã®ã§ãããã£ã¦ãããã§æ¤è¨¼ããã³ã¼ãã¯ãããã£ã¦æ®éããªæ¸ãæ¹ã§ãããå¯èªæ§ãéè¦ããæ¸ãæ¹ã«ãªãã¾ãããèªåã§ã½ã¼ãã¢ã«ã´ãªãºã ã®æ§ç¯
ç®æãããã°ã©ãã¼ï¼ã«ããããã å½ãµã¤ãã¯ãã¡ãã«å¼ã£è¶ãã¾ããã ãææ°ãããããã¾ãããä¸è¨ãµã¤ãã¸ã移åãã ããã¾ãã
1985å¹´ãAT&Tã®Bjarne StroustrupãC++ããã®ä¸ã«éãåºãã¾ããããã®å¾C++ã¯æ§ã ãªæ¡å¼µãç¹°ãè¿ããªããé²åãã¦ãã¾ããã 1991å¹´ãISOã¯C++ã®å½éæ¨æº(standard C++)ãå®ããä½æ¥ãéå§ãã¾ãããæ¨æºC++ã®æçµèæ¡ã¯1997å¹´ã«ISO C++æ¨æºåå§å¡ä¼ã«æ¿èªããã¾ããã æ¨æºC++ãè¦å®ããã®ã¯è¨èªä»æ§ã ããªããC++æ¨æºã©ã¤ãã©ãªãè¦æ ¼ã®ä¸ã§æ確ã«å®ãããã¦ãã¾ããããã¾ã§C++ã®ã©ã¤ãã©ãªã¨ããã°iostreamãããã®ãã®ã§ãããããããããã¾ã§"äºå®ä¸ã®æ¨æº"ã§ããããã¾ããã§ããã ããã¦ãã®C++æ¨æºã©ã¤ãã©ãªã®ä¸é¨ã¨ãã¦çµã¿å ¥ããããã®ãSTL(Standard Template Library)ã§ããããªãã¡STLã¯æ¨æºC++ã®ä»æ§ã®ä¸é¨ã¨ãããã¨ã§ãã åãSTLãç¥ã£ãã®ã¯1995å¹´ãããã¤ãã®ã³ã³ãã¤ã©ãtemplat
ã¤ã³ã¿ã¼ãããä¸ã«ã¯ãç¡æ°ã«æ¬ãè½ã¡ã¦ããï¼ï¼ã¿ãã§èªããã®ã ï¼ï¼ ï¼ï¼ã¨è¨ã£ã¦ãéæ³ãªãã®ã§ã¯ãªãã絶çã«ãªã£ãæ¬ãåºç社ã®è¨±å¯ãå¾ã¦èè ãå ¬éãã¦ãããããªã±ã¼ã¹ã ãããããæ£å¨ãã¦ããã®ã¯ãã£ãããªããããã«æ¸ãã¦ã¿ããªã§å ±æãããã§ã¯ãªããï¼ ã¨æãããããªã³ã¼ãã¼ãä½ã£ã¦ã¿ãããããªããã§ãæ²ç¤ºæ¿ã®ã»ãã§ãæ å ±æä¾çããå¾ ã¡ãã¦ã¾ããâããããBBS web bookã¹ã¬ ããã°ã©ãã³ã° Windows/C/C++ â Standard Template Library ããã°ã©ãã³ã°/ç§åã·ã¹ãã [æ¥æ¬èª] εÏιÏÏημηæ°ã®STLæ¬ã â Win32ãµãã«ã¼ãã³ãº,Win32ãµãã«ã¼ãã³ãº2,å®ä¾ã§å¦ã¶ Win32 APIæ´»ç¨è¡/CQåºç社[æ¥æ¬èª] 常岡 伸äºæ°ã®åèã â ï¼£ããã°ã©ãã³ã°è¨ºæ室/æè¡è©è«ç¤¾[æ¥æ¬èª] â (ã³)ã®æ¥çã®ãªãã/æè¡è©è«ç¤¾[æ¥æ¬èª]
è§ã®ãã¼ã¸ã¸æ»ã STL(Standard Template Library) C++ã®æ¨æºãã³ãã¬ã¼ãã©ã¤ãã©ãªãSTLã®ãã¼ã¸ã§ãã 2003/6/7 ã³ã³ããå ¨ãã¼ã¸æ¨æºã«åããã¦ä¿®æ£ ç®æ¬¡(ã¨äºå®) æ´æ°å±¥æ´ ã¯ããã« STLã¨ã¯? '99 11/07 ä½æ ãã®åã«C++ã§ç¥ã£ã¦ãããªããã°ãªããªãã㨠馴æã¿ããªã(ãããããªã)åèª '99 9/23 ãããã«ä¿®æ£ ãã³ãã¬ã¼ã(template<>) 2001 1/31 æ´æ° ç°å¢ '99 2/20 VCã§SGI_STLã使ããBeOSãegcsç 使ãæ¹ ã¤ãã¬ã¼ã¿(å復å)ã®ä½¿ãæ¹ '99 6/19 æ´æ° é¢æ°ãªãã¸ã§ã¯ãã®ä½¿ãæ¹ '99 7/4 mem_fun()ã®ä½¿ãæ¹è¿½å æ©è¦è¡¨ STLã§ä½¿ã主ãªã¯ã©ã¹ '99 6/13 åã¯ã©ã¹ã®èª¬æãããããã¾ã¨ãã STLã§ä½¿ãããåå '99 6/13 å¾®å¦ã«æ´
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}