{"rsdb":{"rid":"158909","subhead":"","postdate":"0","aid":"119123","fid":"55","uid":"1","topic":"1","content":"
\n

\u672c\u6587\u4e3b\u9898<\/h1> \n

\u8fd9\u51e0\u5929\u5728\u505a\u56fe\u50cf\u5904\u7406\u65b9\u9762\u7684\u7814\u7a76\uff0c\u5176\u4e2d\u6709\u4e00\u90e8\u5206\u662f\u5173\u4e8e\u56fe\u50cf\u5206\u5272\u65b9\u9762\u7684\uff0c\u56fe\u50cf\u76ee\u6807\u5728\u5206\u5272\u51fa\u6765\u4e4b\u540e\u8981\u505a\u8fdb\u4e00\u6b65\u7684\u5904\u7406\uff0c\u56e0\u6b64\u6709\u5fc5\u8981\u5c06\u76ee\u6807\u56fe\u50cf\u7684\u4fe1\u606f\u4fdd\u5b58\u5728\u4e00\u4e2a\u53d8\u91cf\u91cc\u9762\uff0c\u4e00\u5f00\u59cb\u60f3\u5230\u7684\u662f\u6570\u7ec4\uff0c\u4f46\u662f\u9a6c\u4e0a\u5c31\u53d1\u73b0\u4f7f\u7528\u6570\u7ec4\u7684\u7f3a\u70b9\uff1a\u6570\u7ec4\u957f\u5ea6\u56fa\u5b9a\uff0c\u52a8\u6001\u5206\u914d\u5185\u5b58\u5f88\u5bb9\u6613\u5bfc\u81f4\u9519\u8bef\u53d1\u751f\u3002\u6700\u91cd\u8981\u7684\u4e00\u70b9\u662f\u6211\u8981\u4fdd\u5b58\u76ee\u6807\u56fe\u50cf\u7684\u6bcf\u4e00\u70b9\u7684\u5750\u6807\u503c\uff0c\u4f7f\u7528\u6570\u7ec4\u5c31\u6709\u70b9\u65e0\u80fd\u4e3a\u529b\u4e86\u3002\u56e0\u6b64\u5230\u767e\u5ea6\u3001Google\u5927\u795e\u4e0a\u9762\u627e\u601d\u8def\uff0c\u7ec8\u4e8e\u88ab\u6211\u53d1\u73b0\u5728c++\u7684\u6807\u51c6\u5e93\u91cc\u9762\u8fd8\u6709\u8fd9\u4e48\u4e00\u4e2a\u6a21\u677f\u7c7b\uff1alist\uff0c\u4e0b\u9762\u5c31\u662f\u5bf9\u627e\u5230\u7684\u8d44\u6599\u7684\u6c47\u603b\u548c\u52a0\u5de5\u3002<\/p> \n

vc<\/a>6\u81ea\u5e26\u7684msdn\u5e2e\u52a9\u6587\u6863\u7684\u89e3\u91ca<\/h1> \n

\u4ee5\u4e0b\u662f\u5f15\u81eamsdn\u5e2e\u52a9\u6587\u6863\uff08\u4e2d\u6587\u662f\u6211\u81ea\u5df1\u7ffb\u8bd1\u7684\uff0c\u9519\u8bef\u4e4b\u5904\u8bf7\u5305\u6db5\u3002\uff09\uff1a<\/p> \n

The template class describes an object that controls a varying-length sequence of elements of typeT. The sequence is stored as a bidirectional linked list of elements, each containing a member of typeT.<\/p> \n

\u672c\u6a21\u677f\u7c7b\u63cf\u8ff0\u4e86\u4e00\u4e2a\u5bf9\u8c61\uff0c\u8fd9\u4e2a\u5bf9\u8c61\u662f\u7c7b\u578b\u4e3aT\u7684\u53ef\u53d8\u957f\u5ea6\u7684\u5e8f\u5217\u5143\u7d20\u3002\u8fd9\u4e2a\u5e8f\u5217\u91c7\u7528\u53cc\u5411\u94fe\u8868\u7684\u65b9\u5f0f\u5b58\u50a8\u6bcf\u4e00\u4e2a\u5143\u7d20\uff0c\u5176\u4e2d\u6bcf\u4e00\u4e2a\u5143\u7d20\u7684\u6570\u636e\u6d41\u884c\u90fd\u662fT\u3002<\/p> \n

The object allocates and frees storage for the sequence it controls through a protected object named<\/a>allocator, ofclassA. Such an allocator object must have the same external interface as an object of template classallocator. Note thatallocatoris not copied when the object is assigned.<\/p> \n

\u5bf9\u5e8f\u5217\u5bf9\u8c61\u7684\u5206\u914d\u548c\u91ca\u653e\u64cd\u4f5c\u901a\u8fc7\u4e00\u4e2a\u53d7\u4fdd\u62a4\u7684\u5bf9\u8c61allocator\u8fdb\u884c\u3002\u8fd9\u6837\u4e00\u4e2aallocator\u5bf9\u8c61\u5fc5\u987b\u6709\u76f8\u540c\u7684\u5916\u90e8\u63a5\u53e3\u4f5c\u4e3a\u4e00\u4e2a\u6a21\u677f\u7c7b\u5206\u914d\u5668\u7684\u5bf9\u8c61\u3002\u6ce8\u610f\uff1a\u5f53\u5bf9\u8c61\u88ab\u5206\u914d\u4e4b\u540eallocator\u4e0d\u80fd\u88ab\u590d\u5236\u3002<\/p> \n

List reallocationoccurs when a member function must insert or erase elements of the controlled sequence. In all such cases, only iterators or references that point at erased portions of the controlled sequence become<\/a>invalid.<\/p> \n

\u5f53\u4e00\u4e2a\u6210\u5458\u8981\u8fdb\u884cinsert\u6216\u8005erase\u64cd\u4f5c\u65f6\uff0c\u5217\u8868\u7684\u91cd\u65b0\u5206\u914d\u64cd\u4f5c\u53d1\u751f\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ea\u6709\u8fed\u4ee3\u5668\u6216\u8005\u5f15\u7528\u6240\u6307\u5411\u7684\u8981\u5220\u9664\u7684\u5bf9\u8c61\u7684\u6307\u9488\u53d8\u4e3a\u65e0\u6548\u3002<\/p> \n

msdn\u5e2e\u52a9\u6587\u6863\u81ea\u5e26\u7684\u4f8b\u5b50<\/h1> \n

\u4e0b\u9762\u4e3amsdn\u5e2e\u52a9\u6587\u6863\u4e2d\u81ea\u5e26\u7684\u4e00\u4e2a\u4f8b\u5b50\uff0c\u8be5\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528\u8fed\u4ee3\u5668\u8bfb\u53d6\u5217\u8868\u4e2d\u7684\u5143\u7d20\u548c\u8fdb\u884c\u63d2\u5165\u64cd\u4f5c\u3002<\/p> \n

\r\n#include \n  \r\n\n  <\/list><\/pre> \n 
\r\n#include \n  \r\n\n  <\/iostream><\/pre> \n 
\r\nusing namespace std ;\r\n<\/pre> \n 
\r\ntypedef list\n  \n    LISTINT;\r\n\n  <\/int><\/pre> \n 
\r\nvoid main()\r\n<\/pre> \n 
\r\n{\r\n<\/pre> \n 
\r\n    int rgTest1[] = {5,6,7};\r\n<\/pre> \n 
\r\n    int rgTest2[] = {10,11,12};\r\n<\/pre> \n 
\r\n    LISTINT listInt;\r\n<\/pre> \n 
\r\n    LISTINT listAnother;\r\n<\/pre> \n 
\r\n    LISTINT::iterator i;\r\n<\/pre> \n 
\r\n    \/\/ Insert one at a time\r\n<\/pre> \n 
\r\n    listInt.insert (listInt.begin(), 2);\r\n<\/pre> \n 
\r\n    listInt.insert (listInt.begin(), 1);\r\n<\/pre> \n 
\r\n    listInt.insert (listInt.end(), 3);\r\n<\/pre> \n 
\r\n    \/\/ 1 2 3\r\n<\/pre> \n 
\r\n    for (i = listInt.begin(); i != listInt.end(); ++i)\r\n<\/pre> \n 
\r\n        cout << *i << " ";\r\n<\/pre> \n 
\r\n    cout << endl;\r\n<\/pre> \n 
\r\n    \/\/ Insert 3 fours\r\n<\/pre> \n 
\r\n    listInt.insert (listInt.end(), 3, 4);\r\n<\/pre> \n 
\r\n    \/\/ 1 2 3 4 4 4\r\n<\/pre> \n 
\r\n    for (i = listInt.begin(); i != listInt.end(); ++i)\r\n<\/pre> \n 
\r\n        cout << *i << " ";\r\n<\/pre> \n 
\r\n    cout << endl;\r\n<\/pre> \n 
\r\n    \/\/ Insert an array in there\r\n<\/pre> \n 
\r\n    listInt.insert (listInt.end(), rgTest1, rgTest1 + 3);\r\n<\/pre> \n 
\r\n    \/\/ 1 2 3 4 4 4 5 6 7\r\n<\/pre> \n 
\r\n    for (i = listInt.begin(); i != listInt.end(); ++i)\r\n<\/pre> \n 
\r\n        cout << *i << " ";\r\n<\/pre> \n 
\r\n    cout << endl;\r\n<\/pre> \n 
\r\n    \/\/ Insert another LISTINT\r\n<\/pre> \n 
\r\n    listAnother.insert (listAnother.begin(), rgTest2, rgTest2+3);\r\n<\/pre> \n 
\r\n    listInt.insert (listInt.end(), listAnother.begin(), listAnother.end());\r\n<\/pre> \n 
\r\n    \/\/ 1 2 3 4 4 4 5 6 7 10 11 12\r\n<\/pre> \n 
\r\n    for (i = listInt.begin(); i != listInt.end(); ++i)\r\n<\/pre> \n 
\r\n        cout << *i << " ";\r\n<\/pre> \n 
\r\n    cout << endl;\r\n<\/pre> \n 
\r\n}\r\n<\/pre> \n 
\r\nProgram Output is:\r\n<\/pre> \n 
\r\n1 2 3\r\n<\/pre> \n 
\r\n1 2 3 4 4 4\r\n<\/pre> \n 
\r\n1 2 3 4 4 4 5 6 7\r\n<\/pre> \n 
\r\n1 2 3 4 4 4 5 6 7 10 11 12\r\n<\/pre> \n 

list::list\u6a21\u677f\u7c7b\u7684\u4e3b\u8981\u51fd\u6570\u4ecb\u7ecd<\/h1> \n
\r\nassign()  \/\/\u7ed9list\u8d4b\u503c\r\n<\/pre> \n 
\r\nback() \/\/\u8fd4\u56de\u6700\u540e\u4e00\u4e2a\u5143\u7d20\r\n<\/pre> \n 
\r\nbegin() \/\/\u8fd4\u56de\u6307\u5411\u7b2c\u4e00\u4e2a\u5143\u7d20\u7684\u8fed\u4ee3\u5668\r\n<\/pre> \n 
\r\nclear() \/\/\u5220\u9664\u6240\u6709\u5143\u7d20\r\n<\/pre> \n 
\r\nempty() \/\/\u5982\u679clist\u662f\u7a7a\u7684\u5219\u8fd4\u56detrue \r\n<\/pre> \n 
\r\nend() \/\/\u8fd4\u56de\u672b\u5c3e\u7684\u8fed\u4ee3\u5668\r\n<\/pre> \n 
\r\nerase() \/\/\u5220\u9664\u4e00\u4e2a\u5143\u7d20\r\n<\/pre> \n 
\r\nfront() \/\/\u8fd4\u56de\u7b2c\u4e00\u4e2a\u5143\u7d20\r\n<\/pre> \n 
\r\nget_allocator() \/\/\u8fd4\u56delist\u7684\u914d\u7f6e\u5668\r\n<\/pre> \n 
\r\ninsert() \/\/\u63d2\u5165\u4e00\u4e2a\u5143\u7d20\u5230list\u4e2d\r\n<\/pre> \n 
\r\nmax_size() \/\/\u8fd4\u56delist\u80fd\u5bb9\u7eb3\u7684\u6700\u5927\u5143\u7d20\u6570\u91cf\r\n<\/pre> \n 
\r\nmerge() \/\/\u5408\u5e76\u4e24\u4e2alist \r\n<\/pre> \n 
\r\npop_back() \/\/\u5220\u9664\u6700\u540e\u4e00\u4e2a\u5143\u7d20\r\n<\/pre> \n 
\r\npop_front() \/\/\u5220\u9664\u7b2c\u4e00\u4e2a\u5143\u7d20\r\n<\/pre> \n 
\r\npush_back() \/\/\u5728list\u7684\u672b\u5c3e\u6dfb\u52a0\u4e00\u4e2a\u5143\u7d20\r\n<\/pre> \n 
\r\npush_front() \/\/\u5728list\u7684\u5934\u90e8\u6dfb\u52a0\u4e00\u4e2a\u5143\u7d20\r\n<\/pre> \n 
\r\nrbegin() \/\/\u8fd4\u56de\u6307\u5411\u7b2c\u4e00\u4e2a\u5143\u7d20\u7684\u9006\u5411\u8fed\u4ee3\u5668\r\n<\/pre> \n 
\r\nremove_if() \/\/\u6309\u6307\u5b9a\u6761\u4ef6\u5220\u9664\u5143\u7d20\r\n<\/pre> \n 
\r\nremove() \/\/\u4ecelist\u5220\u9664\u5143\u7d20\r\n<\/pre> \n 
\r\nrend() \/\/\u6307\u5411list\u672b\u5c3e\u7684\u9006\u5411\u8fed\u4ee3\u5668\r\n<\/pre> \n 
\r\nresize() \/\/\u6539","orderid":"0","title":"VC++\u4e2dlist::list\u7684\u4f7f\u7528\u65b9\u6cd5\u603b\u7ed3(\u4e00)","smalltitle":"","mid":"0","fname":"windows\u7f16\u7a0b\u57fa\u7840","special_id":"0","bak_id":"0","info":"0","hits":"9079","pages":"5","comments":"0","posttime":"2017-09-21 09:47:09","list":"1505958429","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"list::list<\/A> \u4f7f\u7528\u65b9\u6cd5<\/A> \u603b\u7ed3<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"113.108.110.181","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"VC++\u4e2dlist::list\u7684\u4f7f\u7528\u65b9\u6cd5\u603b\u7ed3","lastview":"1716071932","digg_num":"6308","digg_time":"1711462196","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}