{"id":2090,"date":"2014-11-17T01:24:35","date_gmt":"2014-11-16T16:24:35","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=2090"},"modified":"2017-01-31T19:43:07","modified_gmt":"2017-01-31T10:43:07","slug":"c11-auto-%ed%82%a4%ec%9b%8c%eb%93%9c","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=2090","title":{"rendered":"[C++11] auto \ud0a4\uc6cc\ub4dc"},"content":{"rendered":"<p>\uc6d0\ub798 auto \ud0a4\uc6cc\ub4dc\ub294 \uc800\uc7a5 \ud074\ub798\uc2a4 \uc9c0\uc815\uc790(storage class specifier) \uc911\uc73c\ub85c \ud558\ub098\ub85c \uae30\ubcf8 \uc9c0\uc815\uc790\uc785\ub2c8\ub2e4. \uae30\ubcf8 \uc9c0\uc815\ub77c\ub294 \uc758\ubbf8\ub294 \uad73\uc774 \uc9c0\uc815\ud558\uc9c0 \uc54a\uc544\ub3c4 \uc790\ub3d9\uc73c\ub85c auto\ub85c \uc9c0\uc815\ub41c\ub2e4\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4. \uadf8\ub7ec\ub2e4\ubcf4\ub2c8 \uac70\uc758 \uc0ac\uc6a9\ub418\uc9c0 \uc54a\ub294 \ud0a4\uc6cc\ub4dc\uc600\ub294\ub370 C++11\uc5d0\uc11c \uc774 \ud0a4\uc6cc\ub4dc\uc5d0 \ub9e4\uc6b0 \uac15\ub825\ud55c \uae30\ub2a5\uc744 \ubd80\uc5ec\ud558\uac8c \ub418\uc5c8\uc2b5\ub2c8\ub2e4.<\/p>\n<p>C++11\uc5d0\uc11c auto\uc5d0 \ub300\ud574 \uc0c8\ub86d\uac8c \ubd80\uc5ec\ud55c \uae30\ub2a5\uc73c\ub85c\uc368 \uc758\ubbf8\ub294 \ucef4\ud30c\uc77c \ud0c0\uc784\uc5d0\uc11c \uc790\ub3d9\uc73c\ub85c type\uc744 \uc9c0\uc815\ud560 \uc218 \uc788\ub3c4\ub85d \ud558\ub294 \uac83\uc785\ub2c8\ub2e4. \uc544\ub798\uc758 \ucf54\ub4dc\ub97c \uc608\ub85c \uc0b4\ud3b4\ubcf4\uba74 \uc9c1\uad00\uc801\uc73c\ub85c auto\uc758 \uc758\ubbf8\ub97c \ud30c\uc545\ud560 \uc218 \uc788\uc744 \uac83\uc785\ub2c8\ub2e4.<\/p>\n<pre>\r\n#include \"stdafx.h\"\r\n#include <iostream>;\r\n#include <vector>\r\n\r\nusing namespace std;\r\n\r\nint _tmain(int argc, _TCHAR* argv[])\r\n{\r\n    vector<int> v;\r\n    for(int i=0; i<10; ++i)\r\n    {\r\n        v.push_back(i);\r\n    }\r\n\r\n    vector<int>::iterator it = v.begin();\r\n    while(it != v.end()) {\r\n        cout << *it << endl;\r\n        it++;\r\n    }\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p><P>\uc704\uc758 \ucf54\ub4dc\ub294 \uc6b0\ub9ac\uac00 \ud754\ud788 C++11 \uc774\uc804\uc5d0 \uc368\uc624\ub358 \ucf54\ub4dc\uc785\ub2c8\ub2e4. \ub208\uc5ec\uaca8 \ubd10\uc57c\ud560 \ubd80\ubd84\uc740 \ubc14\ub85c 15\ubc88 \ucf54\ub4dc\uc785\ub2c8\ub2e4. \ubc18\ubcf5\uc790(iterator)\uc758 \ud0c0\uc785\uc744 \uc120\uc5b8\ud558\uae30 \uc704\ud574 vector<int>::iterator\uacfc \uac19\uc774 \uc81c\ubc95 \uae34 \ud0c0\uc785\uba85\uc744 \uc0ac\uc6a9\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uc608\uc81c\uc774\ub2c8 \uadf8\ub807\uc9c0 \uc2e4\uc81c \ucf54\ub4dc\uc5d0\uc11c\ub294 \ub354\uc6b1 \ub354 \uae34 \ud0c0\uc785\uba85\uc774 \ube48\ubc88\ud558\uac8c \ub098\uc635\ub2c8\ub2e4. \uc774\ub97c auto\ub77c\ub294 \ud0a4\uc6cc\ub4dc\ub97c \ud1b5\ud574 \ub2e4\uc74c\ucc98\ub7fc \ub2e8\uc21c\ud558\uac8c \ub9cc\ub4e4 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n<pre>\r\n#include \"stdafx.h\"\r\n#include <iostream>;\r\n#include <vector>\r\n\r\nusing namespace std;\r\n\r\nint _tmain(int argc, _TCHAR* argv[])\r\n{\r\n    vector<int> v;\r\n    for(int i=0; i<10; ++i)\r\n    {\r\n        v.push_back(i);\r\n    }\r\n\r\n    auto it = vInt.begin();\r\n    while(it != v.end()) {\r\n        cout << *it << endl;\r\n        it++;\r\n    }\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p><P>\ubcc0\uacbd\ub41c \ubd80\ubd84\uc740 \uc624\uc9c1 \uc55e\uc11c \uc5b8\uae09\ud55c 15\ubc88 \ucf54\ub4dc\uc785\ub2c8\ub2e4. \ubc14\ub85c vector<int>::iterator \ub300\uc2e0 auto\ub97c \uc0ac\uc6a9\ud588\uc2b5\ub2c8\ub2e4. auto\ub85c \uc120\uc5b8\ub41c \ub370\uc774\ud130 \ud0c0\uc785\uc740 \ucef4\ud30c\uc77c \uc2dc\uc810\uc5d0\uc11c \ucef4\ud30c\uc77c\ub7ec\uc5d0 \uc758\ud574 \uc0c1\ub2f9\ud788 \uc815\ud655\ud558\uac8c \uadf8 \ud0c0\uc785\uc744 \uc720\ucd94\ud574 \uacb0\uc815\ud574 \uc90d\ub2c8\ub2e4.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc6d0\ub798 auto \ud0a4\uc6cc\ub4dc\ub294 \uc800\uc7a5 \ud074\ub798\uc2a4 \uc9c0\uc815\uc790(storage class specifier) \uc911\uc73c\ub85c \ud558\ub098\ub85c \uae30\ubcf8 \uc9c0\uc815\uc790\uc785\ub2c8\ub2e4. \uae30\ubcf8 \uc9c0\uc815\ub77c\ub294 \uc758\ubbf8\ub294 \uad73\uc774 \uc9c0\uc815\ud558\uc9c0 \uc54a\uc544\ub3c4 \uc790\ub3d9\uc73c\ub85c auto\ub85c \uc9c0\uc815\ub41c\ub2e4\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4. \uadf8\ub7ec\ub2e4\ubcf4\ub2c8 \uac70\uc758 \uc0ac\uc6a9\ub418\uc9c0 \uc54a\ub294 \ud0a4\uc6cc\ub4dc\uc600\ub294\ub370 C++11\uc5d0\uc11c \uc774 \ud0a4\uc6cc\ub4dc\uc5d0 \ub9e4\uc6b0 \uac15\ub825\ud55c \uae30\ub2a5\uc744 \ubd80\uc5ec\ud558\uac8c \ub418\uc5c8\uc2b5\ub2c8\ub2e4. C++11\uc5d0\uc11c auto\uc5d0 \ub300\ud574 \uc0c8\ub86d\uac8c \ubd80\uc5ec\ud55c \uae30\ub2a5\uc73c\ub85c\uc368 \uc758\ubbf8\ub294 \ucef4\ud30c\uc77c \ud0c0\uc784\uc5d0\uc11c \uc790\ub3d9\uc73c\ub85c type\uc744 \uc9c0\uc815\ud560 \uc218 \uc788\ub3c4\ub85d \ud558\ub294 \uac83\uc785\ub2c8\ub2e4. \uc544\ub798\uc758 \ucf54\ub4dc\ub97c \uc608\ub85c \uc0b4\ud3b4\ubcf4\uba74 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=2090\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[C++11] auto \ud0a4\uc6cc\ub4dc&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117,8],"tags":[14],"class_list":["post-2090","post","type-post","status-publish","format-standard","hentry","category-cpp","category-programming","tag-c"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2090"}],"version-history":[{"count":1,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2090\/revisions"}],"predecessor-version":[{"id":2829,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2090\/revisions\/2829"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2090"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}