{"id":988,"date":"2009-02-18T02:02:28","date_gmt":"2009-02-17T17:02:28","guid":{"rendered":"http:\/\/terzeron.com\/?p=988"},"modified":"2009-02-18T02:02:28","modified_gmt":"2009-02-17T17:02:28","slug":"stl%ec%9d%98-rope-container","status":"publish","type":"post","link":"https:\/\/terzeron.com\/?p=988","title":{"rendered":"STL\uc758 rope container"},"content":{"rendered":"<p>rope \ucee8\ud14c\uc774\ub108\ub294 C++\uc5d0\uc11c \ubb38\uc790\uc5f4\uc744 \ub2f4\uae30 \uc704\ud574 \uac00\uc7a5 \uc77c\ubc18\uc801\uc73c\ub85c \uc0ac\uc6a9\ub418\ub294 string\uc758 \ud655\uc7a5\uc774\ub2e4. \ub9d0 \uadf8\ub300\ub85c \ud574\uc11d\ud558\uc790\uba74, rope\ub294 \ubc27\uc904\uc774\ub2c8\uae4c string(\ub048)\ubcf4\ub2e4 \uac15\ub825\ud560 \uac83\uc774\ub2e4.<\/p>\n<p><a href=\"http:\/\/www.sgi.com\/tech\/stl\/Rope.html\">SGI\uc5d0\uc11c \uc81c\uc548\ud55c \uc2a4\ud399<\/a>\uc774\uba70 GCC\uc5d0\uc11c \ucc44\ud0dd\ub418\uc5c8\ub2e4. (GCC 3.2.3, 3.4.6, 4.3.3\uc5d0\uc11c \uc81c\uacf5\ub418\uace0 \uc788\ub294 \uac83\uc744 \ud655\uc778\ud558\uc600\uc74c)<\/p>\n<p>SGI \ubb38\uc11c\uc5d0 \ub530\ub974\uba74 \uc7a5\ub2e8\uc810\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<p>\uc7a5\uc810<br \/>\n&#8211; concatenate, substring, insert \uc5f0\uc0b0\uc774 \ud6e8\uc52c \ube60\ub984<br \/>\n&#8211; \uacf5\uac04 \ud65c\uc6a9\ub3c4\uac00 \ub192\uc74c<br \/>\n&#8211; assign\uc740 \ub0b4\ubd80\uc801\uc73c\ub85c pointer assignment\ub85c \uad6c\ud604\ub418\uc5b4 \uc788\uc73c\uba70, \ub808\ud37c\ub7f0\uc2a4 \uce74\uc6b4\ud2b8\ub97c \uc774\uc6a9\ud55c copy-on-write\ubcf4\ub2e4\ub3c4 \ud6a8\uc728\uc801\uc73c\ub85c \ub3d9\uc791\ud568<\/p>\n<p>\ub2e8\uc810<br \/>\n&#8211; 1\uae00\uc790 \uad50\uccb4\uac00 \ube44\uc2fc \uc5f0\uc0b0\uc784<br \/>\n&#8211; \uc5b4\ub5a4 \uae00\uc790\ub97c \ucc3e\ub294 \uc5f0\uc0b0\uc774 vector<char>\ubcf4\ub2e4 \ub290\ub9bc<br \/>\n&#8211; iterator\uac00 12\uac1c word\uc758 \ud06c\uae30\uc640 \ub9de\uba39\uc74c. ++iter\ud574\uc57c \uc548\uc804\ud568<\/p>\n<p>\uc804\ubc18\uc801\uc73c\ub85c\ub294 \ucee4\ub2e4\ub780 \ubb38\uc790\uc5f4\uc744 \uc774\uc5b4\ubd99\uc774\uace0 \uc798\ub77c\ub0b4\ub294 \uc6a9\ub3c4\ub85c \uc801\ud569\ud558\uc9c0\ub9cc C \uc2a4\ud0c0\uc77c\ub85c \ud55c \uae00\uc790\uc529 \ub2e4\ub8e8\ub294 \uac83\uc5d0\ub294 \uadf8\ub2e4\uc9c0 \uc801\ud569\ud558\uc9c0 \uc54a\uc740 \ucee8\ud14c\uc774\ub108\uc774\ub2e4. \ubb3c\ub860 const_iterator\ub97c \uc774\uc6a9\ud558\uc5ec random access\ud558\ub294 \uac83\uc740 \ube60\ub974\ub2e4. \uadf8\ub7ec\ub098 non const_iterarator\ub97c \uac00\uc9c0\uace0 \ubb38\uc790\uc5f4\uc744 \ubcc0\uacbd\ud558\uac8c \ub418\uba74 \uc131\ub2a5 \uc800\ud558\uac00 \uc2ec\uac01\ud574\uc9c4\ub2e4.<\/p>\n<p>\uc5b4\uc9c0\uac04\ud55c \uc5f0\uc0b0\uc790\ub098 method\ub294 string\uacfc \uac70\uc758 \ube44\uc2b7\ud558\ub2e4. string \ub300\uc2e0\uc5d0 crope\uc774\ub77c\uace0 \uc4f0\uba74 \ub41c\ub2e4.<\/p>\n<p>\uc0c8\ub85c\uc6b4 method\ub85c delete_c_str()\uc774 \ucd94\uac00\ub418\uc5c8\ub294\ub370, \uc774 method\ub294 \uc2e4\uc81c \ubb38\uc790\uc5f4\uc774 \uc800\uc7a5\ub418\ub294, c_str()\uc774 \uac00\ub9ac\ud0a4\ub294 \uba54\ubaa8\ub9ac \uacf5\uac04\uc744 \ud68c\uc218\ud55c\ub2e4.<\/p>\n<pre class=\"brush: c++\">#include <iostream>\n#include <ext\/rope>\n#include <string.h>\n\n\nusing namespace std;\nusing namespace __gnu_cxx;\n\n\nint main(void)\n{\n\/\/ string\ucc98\ub7fc assign, concatenate \ub4f1\uc774 \uac00\ub2a5\ud568\ncrope a;\na = \"hello\";\na += \" world\";\ncout << a << endl;\n\n\/\/ string\ucc98\ub7fc \ud2b9\uc815 \ubb38\uc790\ub97c \ubc18\ubcf5\ud558\uc5ec \ubb38\uc790\uc5f4\ub85c \ub9cc\ub4e4 \uc218 \uc788\uc74c\ncrope b(10, 'b');\ncout << b << endl;\n\n\/\/ substr\ncrope c = \"hello world\";\ncout << c.substr(3, 4) << endl;\n\nc.push_front('j');\ncout << c << endl;\n\n\/\/ from char pointer\nchar text[] = \"c c++ java python perl\";\ncrope d = crope(text);\ncout << d << endl;\n\n\/\/ copy\ncrope e(\"original\");\ncrope f;\ncopy(e.begin(), e.end(), sequence_buffer<crope>(f));\ncout << e << endl;\ncout << f << endl;\n\ncrope g(\"gnu linux gcc guile\");\nchar buffer[1024];\ng.copy(1, 2, buffer);\ncout << g << endl;\ncout << buffer << endl; \/\/ not null-terminated\ncout << strlen(buffer) << endl;\n\nreturn 0;\n}<\/pre>\n<div class=\"fb-background-color\">\n\t\t\t  <div \n\t\t\t  \tclass = \"fb-comments\" \n\t\t\t  \tdata-href = \"https:\/\/terzeron.com\/?p=988\"\n\t\t\t  \tdata-numposts = \"100\"\n\t\t\t  \tdata-lazy = \"true\"\n\t\t\t\tdata-colorscheme = \"light\"\n\t\t\t\tdata-order-by = \"time\"\n\t\t\t\tdata-mobile=true>\n\t\t\t  <\/div><\/div>\n\t\t  <style>\n\t\t    .fb-background-color {\n\t\t\t\tbackground: #ffffff !important;\n\t\t\t}\n\t\t\t.fb_iframe_widget_fluid_desktop iframe {\n\t\t\t    width: 100% !important;\n\t\t\t}\n\t\t  <\/style>\n\t\t  ","protected":false},"excerpt":{"rendered":"<p>rope \ucee8\ud14c\uc774\ub108\ub294 C++\uc5d0\uc11c \ubb38\uc790\uc5f4\uc744 \ub2f4\uae30 \uc704\ud574 \uac00\uc7a5 \uc77c\ubc18\uc801\uc73c\ub85c \uc0ac\uc6a9\ub418\ub294 string\uc758 \ud655\uc7a5\uc774\ub2e4. \ub9d0 \uadf8\ub300\ub85c \ud574\uc11d\ud558\uc790\uba74, rope\ub294 \ubc27\uc904\uc774\ub2c8\uae4c string(\ub048)\ubcf4\ub2e4 \uac15\ub825\ud560 \uac83\uc774\ub2e4. SGI\uc5d0\uc11c \uc81c\uc548\ud55c \uc2a4\ud399\uc774\uba70 GCC\uc5d0\uc11c \ucc44\ud0dd\ub418\uc5c8\ub2e4. (GCC 3.2.3, 3.4.6, 4.3.3\uc5d0\uc11c \uc81c\uacf5\ub418\uace0 \uc788\ub294 \uac83\uc744 \ud655\uc778\ud558\uc600\uc74c) SGI \ubb38\uc11c\uc5d0 \ub530\ub974\uba74 \uc7a5\ub2e8\uc810\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4. \uc7a5\uc810 &#8211; &hellip; <a href=\"https:\/\/terzeron.com\/?p=988\">\uacc4\uc18d \uc77d\uae30 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[13],"tags":[],"class_list":["post-988","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/terzeron.com\/index.php?rest_route=\/wp\/v2\/posts\/988","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/terzeron.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/terzeron.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/terzeron.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/terzeron.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=988"}],"version-history":[{"count":0,"href":"https:\/\/terzeron.com\/index.php?rest_route=\/wp\/v2\/posts\/988\/revisions"}],"wp:attachment":[{"href":"https:\/\/terzeron.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/terzeron.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/terzeron.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}