{"id":2091,"date":"2014-11-17T02:06:01","date_gmt":"2014-11-16T17:06:01","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=2091"},"modified":"2017-02-06T14:24:49","modified_gmt":"2017-02-06T05:24:49","slug":"c11-%eb%b2%94%ec%9c%84-%ea%b8%b0%eb%b0%98-for-%eb%ac%b8","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=2091","title":{"rendered":"[C++11] \ubc94\uc704 \uae30\ubc18 for \ubb38"},"content":{"rendered":"<p><P>for \ubb38\uc740 \ucd08\uae30\uac12\uacfc \ubc18\ubcf5\uc870\uac74 \uadf8\ub9ac\uace0 \uc99d\uac10(\uac10\uc18c)\ubb38\uc73c\ub85c \uad6c\uc131\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4. C++11\uc5d0\uc11c\ub294 \ub2e4\uc18c \ubcf5\uc7a1\ud55c for \ubb38 \ub300\uc2e0 \ubcf4\ub2e4 \uac04\uacb0\ud55c \ubc94\uc704 \uae30\ubc18\uc758 for \ubb38\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4. \uc544\ub798\uc758 \uc608\ub97c \uc0b4\ud3b4\ubcf4\ub3c4\ub85d \ud558\uaca0\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    for(vector<int>::const_iterator it = v.cbegin(); it != v.cend(); ++it) {\r\n        cout << *it << endl;\r\n    }\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p><P>15\ubc88 \ucf54\ub4dc\ub97c \ubcf4\uba74 for\ubb38\uc5d0 \ub300\ud55c \ucd08\uae30\uac12, \uc870\uac74\uac12, \uc99d\uac10\ubb38\uc73c\ub85c \uad6c\uc131\ub418\uc5b4 \uc788\ub294 \uac83\uc744 \ubcfc \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774\ub97c \ubc94\uc704 \uae30\ubc18\uc758 for \ubb38\uc744 \uc0ac\uc6a9\ud558\uc5ec \ub2e4\uc74c\uacfc \uac19\uc774 \ub2e8\uc21c\ud558\uac8c \ucf54\ub4dc\ub97c \uad6c\uc131\ud560 \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    for(int i: v) {\r\n        cout << i << endl;\r\n    }\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p><P>\ubcc0\uacbd\ub41c 15\ubc88\uc9f8 \uc904 \ucf54\ub4dc\ub97c \ubcf4\uba74 \uc624\uc9c1 \ubc18\ubcf5\ud558\uc5ec \uc5bb\ub294 \uac12\uc5d0 \ub300\ud55c \uc815\uc758\ub9cc \uc788\uc2b5\ub2c8\ub2e4. \ub9e4\uc6b0 \uc9c1\uad00\uc801\uc774\ub77c\ub294 \uac83\uacfc \ubc18\ubcf5\uc5d0 \ub300\ud55c \ubc94\uc704\ub97c \uace0\ubbfc\ud560 \ud544\uc694\uac00 \uc5c6\ub2e4\ub294 \uac83\uc744 \uc54c \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \ubc94\uc704 \uae30\ubc18\uc758 for\ubb38\uc5d0 \ub300\ud574 \ud55c\uac00\uc9c0 \ub354 \uc0b4\ud3b4\ubcf8\ub2e4\uba74 \ubc14\ub85c \ubc18\ubcf5\uc5d0 \ub300\ud55c \ucc38\uc870\uac12\uc758 \uc0ac\uc6a9\uc785\ub2c8\ub2e4. \uc704\uc758 \ucf54\ub4dc\ub294 \ucc38\uc870\uac12\uc774 \uc544\ub2c8\ubbc0\ub85c \ubc18\ubcf5\ubb38 \uc548\uc5d0\uc11c \uac12\uc5d0 \ub300\ud574 \ubcc0\uacbd\ud560 \uacbd\uc6b0 \uc6d0\ubcf8\uc740 \ubcc0\uacbd\ub418\uc9c0 \uc54a\ub294\ub2e4\ub294 \uac83\uc785\ub2c8\ub2e4. \uc6d0\ubcf8\uc758 \ubcc0\uacbd\uc774 \ud544\uc694\ud560 \uacbd\uc6b0 \ub2e4\uc74c\uacfc \uac19\uc774 \ucc38\uc870\uac12\uc744 \uc774\uc6a9\ud558\uc5ec for \ubb38\uc744 \uad6c\uc131\ud560 \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    for(int &#038;i: v) {\r\n         i*= 2;\r\n    }\r\n\r\n    for(int i: v) {\r\n        cout << i << endl;\r\n    }\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p><P>15\ubc88 \ucf54\ub4dc\uc5d0\uc11c int &i\uc640 \uac19\uc740 \ucc38\uc870 \ud0c0\uc785\uc744 \uc0ac\uc6a9\ud558\uc600\uc73c\ubbc0\ub85c \uc6d0\ubcf8\uac12\uc744 \ubcc0\uacbd\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc704\uc758 \ucf54\ub4dc\ub294 C++11\uc5d0\uc11c \uc0c8\ub86d\uac8c \uc815\uc758\ub418\uc5b4 \uc9c0\uc6d0\ub418\ub294 auto \uae30\ub2a5\uc744 \uc774\uc6a9\ud558\uc5ec \ub2e4\uc74c\ucc98\ub7fc \ub3d9\uc77c\ud55c \uae30\ub2a5\uc73c\ub85c \ubcc0\uacbd\ud560 \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(auto i=0; i<10; ++i)\r\n    {\r\n        v.push_back(i);\r\n    }\r\n\r\n    for(auto &#038;i: v) {\r\n        i *= 2;\r\n    }\r\n\r\n    for(auto i: v) {\r\n        cout << i << endl;\r\n    }\r\n\t\r\n    return 0;\r\n}\r\n<\/pre>\n<p><P>\ud55c\ubc88 \uc815\uc758\ub41c \ub370\uc774\ud130\uc5d0 \ub300\ud574\uc11c \uc774\ud6c4\uc5d0 \uad73\uc774 \uadf8 \ud0c0\uc785\uc744 \ucc3e\uc544 \uc785\ub825\ud560 \ud544\uc694\uc5c6\uc774 auto \ud0a4\uc6cc\ub4dc\ub97c \ud1b5\ud574 \ub9e4\uc6b0 \uc9c1\uad00\uc801\uc774\uace0 \uaf2d \ud544\uc694\ud55c \uc0ac\uace0(Thinking)\ub9cc\uc744 \ud560 \uc218 \uc788\ub3c4\ub85d \uc9c0\uc6d0\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>for \ubb38\uc740 \ucd08\uae30\uac12\uacfc \ubc18\ubcf5\uc870\uac74 \uadf8\ub9ac\uace0 \uc99d\uac10(\uac10\uc18c)\ubb38\uc73c\ub85c \uad6c\uc131\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4. C++11\uc5d0\uc11c\ub294 \ub2e4\uc18c \ubcf5\uc7a1\ud55c for \ubb38 \ub300\uc2e0 \ubcf4\ub2e4 \uac04\uacb0\ud55c \ubc94\uc704 \uae30\ubc18\uc758 for \ubb38\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4. \uc544\ub798\uc758 \uc608\ub97c \uc0b4\ud3b4\ubcf4\ub3c4\ub85d \ud558\uaca0\uc2b5\ub2c8\ub2e4. #include &#8220;stdafx.h&#8221; #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { vector v; for(int i=0; i<\/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-2091","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\/2091","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=2091"}],"version-history":[{"count":3,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2091\/revisions"}],"predecessor-version":[{"id":4407,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2091\/revisions\/4407"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2091"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2091"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}