{"action":"opened","issue":{"url":"https://api.github.com/repos/zouxiaohang/TinySTL/issues/7","labels_url":"https://api.github.com/repos/zouxiaohang/TinySTL/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/zouxiaohang/TinySTL/issues/7/comments","events_url":"https://api.github.com/repos/zouxiaohang/TinySTL/issues/7/events","html_url":"https://github.com/zouxiaohang/TinySTL/issues/7","id":118625333,"number":7,"title":"Vector中的insert函数存在问题","user":{"login":"jiangtao92","id":4179376,"avatar_url":"https://avatars.githubusercontent.com/u/4179376?v=3","gravatar_id":"","url":"https://api.github.com/users/jiangtao92","html_url":"https://github.com/jiangtao92","followers_url":"https://api.github.com/users/jiangtao92/followers","following_url":"https://api.github.com/users/jiangtao92/following{/other_user}","gists_url":"https://api.github.com/users/jiangtao92/gists{/gist_id}","starred_url":"https://api.github.com/users/jiangtao92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiangtao92/subscriptions","organizations_url":"https://api.github.com/users/jiangtao92/orgs","repos_url":"https://api.github.com/users/jiangtao92/repos","events_url":"https://api.github.com/users/jiangtao92/events{/privacy}","received_events_url":"https://api.github.com/users/jiangtao92/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-24T14:52:09Z","updated_at":"2015-11-24T14:52:09Z","closed_at":null,"body":"你好\r\n我看过你的insert函数,存在一点问题,下面是我的测试代码\r\n\r\n```cpp\r\n\t\tnamespace JJ\r\n\t\t{\r\n#include <iostream>\r\n\t\t\tusing namespace std;\r\n\t\t\tclass TestItem\r\n\t\t\t{\r\n\t\t\tpublic:\r\n\t\t\t\tTestItem()\r\n\t\t\t\t{\r\n\t\t\t\t\t++count;\r\n\t\t\t\t\tcout << \"Construct\" << endl;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tTestItem(const TestItem & other)\r\n\t\t\t\t{\r\n\t\t\t\t\t++count;\r\n\t\t\t\t\tcout << \"Copy Construct\" << endl;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvirtual ~TestItem()\r\n\t\t\t\t{\r\n\t\t\t\t\t--count;\r\n\t\t\t\t\tcout << \"Destructor\" << endl;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstatic int getCount()\r\n\t\t\t\t{\r\n\t\t\t\t\treturn count;\r\n\t\t\t\t}\r\n\t\t\tprivate:\r\n\t\t\t\tstatic int count;\r\n\t\t\t};\r\n\r\n\t\t\tint TestItem::count = 0;\r\n\r\n\t\t\tvoid testCase16()\r\n\t\t\t{\r\n\t\t\t\tassert(TestItem::getCount() == 0);\r\n\t\t\t\t{\r\n\t\t\t\t\ttypedef TinySTL::vector<TestItem> TVector;\r\n\t\t\t\t\t//typedef std::vector<TestItem> TVector;\r\n\t\t\t\t\tTVector t(10);\r\n\t\t\t\t\tt.push_back(TestItem());\r\n\t\t\t\t\tt.push_back(TestItem());\r\n\t\t\t\t\tt.push_back(TestItem());\r\n\t\t\t\t\t//t.insert(t.begin(), 10, TestItem());\r\n\t\t\t\t\tcout << t.capacity() << endl;\r\n\t\t\t\t\t\r\n\t\t\t\t\tt.insert(t.begin(), t.begin(), t.begin() + 1);\r\n\t\t\t\t\tcout << t.size() << endl;\r\n\t\t\t\t\tt.clear();\r\n\t\t\t\t}\r\n\t\t\t\tassert(TestItem::getCount() == 0);\r\n\r\n\t\t\t}\r\n\t\t}\r\n```\r\n\r\n你的这个函数的实现里面,调用了\r\n```cpp\r\nvoid insert_aux(iterator position, InputIterator first, InputIterator last, std::false_type);\r\n```"}}