ãã³ãã©ãªã»ãããã¡ã¨ãã¦ã® std::vector ã®å©ç¨ æ©ã¾ãããã³ãã©ãªã»ãããã¡ ä¸æçã«å¿ è¦ã¨ãªãé åãããªãã¡ãã³ãã©ãªã»ãããã¡ã¯ããã°ã©ã ã®ãããã¨ããã§ç¨ãããã¾ãã void f() { char buffer[256]; ... } ä¸ã®ä¾ã§ã¯256[char]ã®bufferãautomaticé åã«ç¢ºä¿ãã¦ãã¾ãã å ´åã«ãã£ã¦ã¯ãã®ãããªåºå®ãµã¤ãºã§ã¯ãªããå¯å¤é·ã®ãã³ãã©ãªã»ãããã¡ãå¿ è¦ã¨ãã¾ããå¯å¤é·ã®ãã³ãã©ãªã»ãããã¡ãå¿ è¦ãªã¨ããé常opeartor newã«ãã£ã¦ãã¼ãé åãã確ä¿ããã§ãããã void f() { char* buffer = new char[N]; // Nã¯å¤æ° ... delete[] buffer; } å½ç¶ã®ãã¨ãªãããoperator newã«ãã£ã¦ãã¼ããã確ä¿ããé åã¯ãå©ç¨å¾éããã«operator dele
{{#tags}}- {{label}}
{{/tags}}