{"action":"created","comment":{"url":"https://api.github.com/repos/asanikushin/hash_table/pulls/comments/175294729","pull_request_review_id":104802891,"id":175294729,"diff_hunk":"@@ -1,192 +0,0 @@\n-#include <vector>\n-#include <list>\n-#include <initializer_list>\n-#include <iostream>\n-\n-template<class KeyType, class ValueType, class Hash = std::hash<KeyType> >\n-class HashMap {\n-private:\n-    using Elems = typename std::pair<const KeyType, ValueType>;\n-    using MyList = typename std::list<Elems>;\n-\n-    Hash hasher;\n-    std::size_t sz = 0;\n-    std::size_t alloc = 2;\n-    MyList data;\n-    std::vector<typename MyList::iterator> baskets;\n-\n-    void rebuild() {\n-        HashMap tmp(hasher);\n-        tmp = *this;\n-        *this = tmp;\n-    }\n-\n-    bool check(typename MyList::iterator place, std::size_t basket) const {\n-        if (place == data.end()) {\n-            return false;\n-        }\n-        return hasher(place->first) % alloc == basket;\n-    }\n-\n-    void full_check(std::string text = \"\") const {\n-        std::size_t cnt = 0;\n-        for (std::size_t bask = 0; bask < alloc; ++bask) {\n-            typename MyList::iterator cur = baskets[bask];\n-            while (check(cur, bask)) {\n-                cnt++;\n-                cur++;\n-            }\n-        }\n-        if (cnt != sz) {\n-            std::cout << \"Incorrect size:\\nsize = \" << sz << \"; found = \" << cnt << \"\\n\";\n-            std::cout << text;\n-            std::cerr << \"Incorrect size:\\nsize = \" << sz << \"; found = \" << cnt << \"\\n\";\n-            std::cerr << text;\n-            exit(0);\n-        }\n-    }\n-\n-public:\n-    HashMap(Hash _hasher) : hasher(_hasher), sz(0), alloc(2) {\n-        baskets.resize(alloc, data.end());\n-    }\n-\n-    HashMap(std::size_t _alloc = 2, Hash _hasher = Hash()) : hasher(_hasher), sz(0), alloc(_alloc) {\n-        baskets.resize(alloc, data.end());\n-    }\n-\n-    std::size_t size() const {\n-        return sz;\n-    }\n-\n-    bool empty() const {\n-        return sz == 0;\n-    }\n-\n-    Hash hash_function() const {\n-        return hasher;\n-    }\n-\n-    using iterator = typename MyList::iterator;\n-    using const_iterator = typename MyList::const_iterator;\n-\n-    const_iterator begin() const {\n-        return data.cbegin();\n-    }\n-\n-    iterator begin() {\n-        return data.begin();\n-    }\n-\n-    const_iterator end() const {\n-        return data.cend();\n-    }\n-\n-    iterator end() {\n-        return data.end();\n-    }\n-\n-    const_iterator find(KeyType key) const {\n-        std::size_t pos = hasher(key) % alloc;\n-        iterator cur = baskets[pos];\n-        while (check(cur, pos) && !(cur->first == key)) {\n-            cur++;\n-        }\n-        if (check(cur, pos)) {\n-            return cur;\n-        } else {\n-            return end();\n-        }\n-    }\n-\n-    iterator find(KeyType key) {\n-        std::size_t pos = hasher(key) % alloc;\n-        iterator cur = baskets[pos];\n-        while (check(cur, pos) && !(cur->first == key)) {\n-            cur++;\n-        }\n-        if (check(cur, pos)) {\n-            return cur;\n-        } else {\n-            return end();\n-        }\n-    }\n-\n-    void insert(std::pair<KeyType, ValueType> elem) {\n-        if (find(elem.first) == end()) {\n-            std::size_t pos = hasher(elem.first) % alloc;\n-            iterator cur = baskets[pos];\n-            baskets[pos] = data.insert(cur, elem);\n-            sz++;\n-        }\n-        if (sz * 2 > alloc) {\n-            rebuild();\n-        }\n-    }\n-\n-    void erase(KeyType key) {\n-        iterator cur = find(key);\n-        if (cur != end()) {\n-            std::size_t pos = hasher(key) % alloc;\n-            if (baskets[pos] == cur) {\n-                baskets[pos] = data.erase(cur);\n-            } else {\n-                data.erase(cur);\n-            }\n-            if (!check(baskets[pos], pos)) {\n-                baskets[pos] = data.end();\n-            }\n-            sz--;\n-        }\n-    }\n-\n-    ValueType &operator[](KeyType key) {\n-        insert({key, ValueType()});\n-        iterator cur = find(key);\n-        return cur->second;\n-    }\n-\n-    const ValueType &at(KeyType key) const {\n-        const_iterator cur = find(key);\n-        if (cur == end()) {\n-            std::__throw_out_of_range(\"\");\n-        }\n-        return cur->second;\n-    }\n-\n-    void clear() {\n-        sz = 0;\n-        data.clear();\n-        baskets.assign(alloc, data.end());\n-    }\n-\n-\n-    template<class Iter>\n-    HashMap(Iter start, Iter end, Hash _hasher = Hash()) : hasher(_hasher), sz(0), alloc(2) {\n-        baskets.resize(2, data.end());\n-        for (; start != end; ++start) {\n-            insert({start->first, start->second});\n-        }\n-    }\n-\n-    HashMap(std::initializer_list<std::pair<KeyType, ValueType>> d_, Hash _hasher = Hash()) : HashMap(d_.begin(),\n-                                                                                                      d_.end(),\n-                                                                                                      _hasher) {}\n-\n-    HashMap(const HashMap &other) : HashMap(other.begin(), other.end(), other.hasher) {}\n-\n-    HashMap &operator=(const HashMap &other) {\n-        if (this == &other) {\n-            return *this;\n-        }\n-        clear();\n-        alloc = std::min(other.alloc * 2 + 1, other.sz * 6);\n-        if (alloc == 0)\n-            alloc = 2;\n-        baskets.assign(alloc, data.end());\n-        for (auto x : other) {\n-            insert(x);\n-        }\n-        return *this;\n-    }\n-};","path":"hash_map.h","position":192,"original_position":192,"commit_id":"0789d1ee97bca59765b7ba4d3b20a89732e333b3","original_commit_id":"0789d1ee97bca59765b7ba4d3b20a89732e333b3","user":{"login":"danlark1","id":15173761,"avatar_url":"https://avatars2.githubusercontent.com/u/15173761?v=4","gravatar_id":"","url":"https://api.github.com/users/danlark1","html_url":"https://github.com/danlark1","followers_url":"https://api.github.com/users/danlark1/followers","following_url":"https://api.github.com/users/danlark1/following{/other_user}","gists_url":"https://api.github.com/users/danlark1/gists{/gist_id}","starred_url":"https://api.github.com/users/danlark1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danlark1/subscriptions","organizations_url":"https://api.github.com/users/danlark1/orgs","repos_url":"https://api.github.com/users/danlark1/repos","events_url":"https://api.github.com/users/danlark1/events{/privacy}","received_events_url":"https://api.github.com/users/danlark1/received_events","type":"User","site_admin":false},"body":"не удаляй файл, а добавь его, на красном фоне неудобно ревьюить","created_at":"2018-03-18T16:30:47Z","updated_at":"2018-03-18T16:30:51Z","html_url":"https://github.com/asanikushin/hash_table/pull/1#discussion_r175294729","pull_request_url":"https://api.github.com/repos/asanikushin/hash_table/pulls/1","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/asanikushin/hash_table/pulls/comments/175294729"},"html":{"href":"https://github.com/asanikushin/hash_table/pull/1#discussion_r175294729"},"pull_request":{"href":"https://api.github.com/repos/asanikushin/hash_table/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/asanikushin/hash_table/pulls/1","id":175597231,"html_url":"https://github.com/asanikushin/hash_table/pull/1","diff_url":"https://github.com/asanikushin/hash_table/pull/1.diff","patch_url":"https://github.com/asanikushin/hash_table/pull/1.patch","issue_url":"https://api.github.com/repos/asanikushin/hash_table/issues/1","number":1,"state":"open","locked":false,"title":"erase hash_map.h from master","user":{"login":"asanikushin","id":34816198,"avatar_url":"https://avatars3.githubusercontent.com/u/34816198?v=4","gravatar_id":"","url":"https://api.github.com/users/asanikushin","html_url":"https://github.com/asanikushin","followers_url":"https://api.github.com/users/asanikushin/followers","following_url":"https://api.github.com/users/asanikushin/following{/other_user}","gists_url":"https://api.github.com/users/asanikushin/gists{/gist_id}","starred_url":"https://api.github.com/users/asanikushin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asanikushin/subscriptions","organizations_url":"https://api.github.com/users/asanikushin/orgs","repos_url":"https://api.github.com/users/asanikushin/repos","events_url":"https://api.github.com/users/asanikushin/events{/privacy}","received_events_url":"https://api.github.com/users/asanikushin/received_events","type":"User","site_admin":false},"body":"Check code","created_at":"2018-03-16T17:22:39Z","updated_at":"2018-03-18T16:30:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c00f5569ffa86f5904259455f1d2d32dad2149b8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/asanikushin/hash_table/pulls/1/commits","review_comments_url":"https://api.github.com/repos/asanikushin/hash_table/pulls/1/comments","review_comment_url":"https://api.github.com/repos/asanikushin/hash_table/pulls/comments{/number}","comments_url":"https://api.github.com/repos/asanikushin/hash_table/issues/1/comments","statuses_url":"https://api.github.com/repos/asanikushin/hash_table/statuses/0789d1ee97bca59765b7ba4d3b20a89732e333b3","head":{"label":"asanikushin:master","ref":"master","sha":"0789d1ee97bca59765b7ba4d3b20a89732e333b3","user":{"login":"asanikushin","id":34816198,"avatar_url":"https://avatars3.githubusercontent.com/u/34816198?v=4","gravatar_id":"","url":"https://api.github.com/users/asanikushin","html_url":"https://github.com/asanikushin","followers_url":"https://api.github.com/users/asanikushin/followers","following_url":"https://api.github.com/users/asanikushin/following{/other_user}","gists_url":"https://api.github.com/users/asanikushin/gists{/gist_id}","starred_url":"https://api.github.com/users/asanikushin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asanikushin/subscriptions","organizations_url":"https://api.github.com/users/asanikushin/orgs","repos_url":"https://api.github.com/users/asanikushin/repos","events_url":"https://api.github.com/users/asanikushin/events{/privacy}","received_events_url":"https://api.github.com/users/asanikushin/received_events","type":"User","site_admin":false},"repo":{"id":125485786,"name":"hash_table","full_name":"asanikushin/hash_table","owner":{"login":"asanikushin","id":34816198,"avatar_url":"https://avatars3.githubusercontent.com/u/34816198?v=4","gravatar_id":"","url":"https://api.github.com/users/asanikushin","html_url":"https://github.com/asanikushin","followers_url":"https://api.github.com/users/asanikushin/followers","following_url":"https://api.github.com/users/asanikushin/following{/other_user}","gists_url":"https://api.github.com/users/asanikushin/gists{/gist_id}","starred_url":"https://api.github.com/users/asanikushin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asanikushin/subscriptions","organizations_url":"https://api.github.com/users/asanikushin/orgs","repos_url":"https://api.github.com/users/asanikushin/repos","events_url":"https://api.github.com/users/asanikushin/events{/privacy}","received_events_url":"https://api.github.com/users/asanikushin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/asanikushin/hash_table","description":null,"fork":false,"url":"https://api.github.com/repos/asanikushin/hash_table","forks_url":"https://api.github.com/repos/asanikushin/hash_table/forks","keys_url":"https://api.github.com/repos/asanikushin/hash_table/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asanikushin/hash_table/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asanikushin/hash_table/teams","hooks_url":"https://api.github.com/repos/asanikushin/hash_table/hooks","issue_events_url":"https://api.github.com/repos/asanikushin/hash_table/issues/events{/number}","events_url":"https://api.github.com/repos/asanikushin/hash_table/events","assignees_url":"https://api.github.com/repos/asanikushin/hash_table/assignees{/user}","branches_url":"https://api.github.com/repos/asanikushin/hash_table/branches{/branch}","tags_url":"https://api.github.com/repos/asanikushin/hash_table/tags","blobs_url":"https://api.github.com/repos/asanikushin/hash_table/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asanikushin/hash_table/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asanikushin/hash_table/git/refs{/sha}","trees_url":"https://api.github.com/repos/asanikushin/hash_table/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asanikushin/hash_table/statuses/{sha}","languages_url":"https://api.github.com/repos/asanikushin/hash_table/languages","stargazers_url":"https://api.github.com/repos/asanikushin/hash_table/stargazers","contributors_url":"https://api.github.com/repos/asanikushin/hash_table/contributors","subscribers_url":"https://api.github.com/repos/asanikushin/hash_table/subscribers","subscription_url":"https://api.github.com/repos/asanikushin/hash_table/subscription","commits_url":"https://api.github.com/repos/asanikushin/hash_table/commits{/sha}","git_commits_url":"https://api.github.com/repos/asanikushin/hash_table/git/commits{/sha}","comments_url":"https://api.github.com/repos/asanikushin/hash_table/comments{/number}","issue_comment_url":"https://api.github.com/repos/asanikushin/hash_table/issues/comments{/number}","contents_url":"https://api.github.com/repos/asanikushin/hash_table/contents/{+path}","compare_url":"https://api.github.com/repos/asanikushin/hash_table/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asanikushin/hash_table/merges","archive_url":"https://api.github.com/repos/asanikushin/hash_table/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asanikushin/hash_table/downloads","issues_url":"https://api.github.com/repos/asanikushin/hash_table/issues{/number}","pulls_url":"https://api.github.com/repos/asanikushin/hash_table/pulls{/number}","milestones_url":"https://api.github.com/repos/asanikushin/hash_table/milestones{/number}","notifications_url":"https://api.github.com/repos/asanikushin/hash_table/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asanikushin/hash_table/labels{/name}","releases_url":"https://api.github.com/repos/asanikushin/hash_table/releases{/id}","deployments_url":"https://api.github.com/repos/asanikushin/hash_table/deployments","created_at":"2018-03-16T08:21:42Z","updated_at":"2018-03-16T08:41:57Z","pushed_at":"2018-03-16T17:22:40Z","git_url":"git://github.com/asanikushin/hash_table.git","ssh_url":"git@github.com:asanikushin/hash_table.git","clone_url":"https://github.com/asanikushin/hash_table.git","svn_url":"https://github.com/asanikushin/hash_table","homepage":null,"size":2,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"asanikushin:hash_map","ref":"hash_map","sha":"c54a10e967b975ab4b98c2b35b2947f844d4c933","user":{"login":"asanikushin","id":34816198,"avatar_url":"https://avatars3.githubusercontent.com/u/34816198?v=4","gravatar_id":"","url":"https://api.github.com/users/asanikushin","html_url":"https://github.com/asanikushin","followers_url":"https://api.github.com/users/asanikushin/followers","following_url":"https://api.github.com/users/asanikushin/following{/other_user}","gists_url":"https://api.github.com/users/asanikushin/gists{/gist_id}","starred_url":"https://api.github.com/users/asanikushin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asanikushin/subscriptions","organizations_url":"https://api.github.com/users/asanikushin/orgs","repos_url":"https://api.github.com/users/asanikushin/repos","events_url":"https://api.github.com/users/asanikushin/events{/privacy}","received_events_url":"https://api.github.com/users/asanikushin/received_events","type":"User","site_admin":false},"repo":{"id":125485786,"name":"hash_table","full_name":"asanikushin/hash_table","owner":{"login":"asanikushin","id":34816198,"avatar_url":"https://avatars3.githubusercontent.com/u/34816198?v=4","gravatar_id":"","url":"https://api.github.com/users/asanikushin","html_url":"https://github.com/asanikushin","followers_url":"https://api.github.com/users/asanikushin/followers","following_url":"https://api.github.com/users/asanikushin/following{/other_user}","gists_url":"https://api.github.com/users/asanikushin/gists{/gist_id}","starred_url":"https://api.github.com/users/asanikushin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asanikushin/subscriptions","organizations_url":"https://api.github.com/users/asanikushin/orgs","repos_url":"https://api.github.com/users/asanikushin/repos","events_url":"https://api.github.com/users/asanikushin/events{/privacy}","received_events_url":"https://api.github.com/users/asanikushin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/asanikushin/hash_table","description":null,"fork":false,"url":"https://api.github.com/repos/asanikushin/hash_table","forks_url":"https://api.github.com/repos/asanikushin/hash_table/forks","keys_url":"https://api.github.com/repos/asanikushin/hash_table/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asanikushin/hash_table/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asanikushin/hash_table/teams","hooks_url":"https://api.github.com/repos/asanikushin/hash_table/hooks","issue_events_url":"https://api.github.com/repos/asanikushin/hash_table/issues/events{/number}","events_url":"https://api.github.com/repos/asanikushin/hash_table/events","assignees_url":"https://api.github.com/repos/asanikushin/hash_table/assignees{/user}","branches_url":"https://api.github.com/repos/asanikushin/hash_table/branches{/branch}","tags_url":"https://api.github.com/repos/asanikushin/hash_table/tags","blobs_url":"https://api.github.com/repos/asanikushin/hash_table/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asanikushin/hash_table/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asanikushin/hash_table/git/refs{/sha}","trees_url":"https://api.github.com/repos/asanikushin/hash_table/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asanikushin/hash_table/statuses/{sha}","languages_url":"https://api.github.com/repos/asanikushin/hash_table/languages","stargazers_url":"https://api.github.com/repos/asanikushin/hash_table/stargazers","contributors_url":"https://api.github.com/repos/asanikushin/hash_table/contributors","subscribers_url":"https://api.github.com/repos/asanikushin/hash_table/subscribers","subscription_url":"https://api.github.com/repos/asanikushin/hash_table/subscription","commits_url":"https://api.github.com/repos/asanikushin/hash_table/commits{/sha}","git_commits_url":"https://api.github.com/repos/asanikushin/hash_table/git/commits{/sha}","comments_url":"https://api.github.com/repos/asanikushin/hash_table/comments{/number}","issue_comment_url":"https://api.github.com/repos/asanikushin/hash_table/issues/comments{/number}","contents_url":"https://api.github.com/repos/asanikushin/hash_table/contents/{+path}","compare_url":"https://api.github.com/repos/asanikushin/hash_table/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asanikushin/hash_table/merges","archive_url":"https://api.github.com/repos/asanikushin/hash_table/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asanikushin/hash_table/downloads","issues_url":"https://api.github.com/repos/asanikushin/hash_table/issues{/number}","pulls_url":"https://api.github.com/repos/asanikushin/hash_table/pulls{/number}","milestones_url":"https://api.github.com/repos/asanikushin/hash_table/milestones{/number}","notifications_url":"https://api.github.com/repos/asanikushin/hash_table/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asanikushin/hash_table/labels{/name}","releases_url":"https://api.github.com/repos/asanikushin/hash_table/releases{/id}","deployments_url":"https://api.github.com/repos/asanikushin/hash_table/deployments","created_at":"2018-03-16T08:21:42Z","updated_at":"2018-03-16T08:41:57Z","pushed_at":"2018-03-16T17:22:40Z","git_url":"git://github.com/asanikushin/hash_table.git","ssh_url":"git@github.com:asanikushin/hash_table.git","clone_url":"https://github.com/asanikushin/hash_table.git","svn_url":"https://github.com/asanikushin/hash_table","homepage":null,"size":2,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/asanikushin/hash_table/pulls/1"},"html":{"href":"https://github.com/asanikushin/hash_table/pull/1"},"issue":{"href":"https://api.github.com/repos/asanikushin/hash_table/issues/1"},"comments":{"href":"https://api.github.com/repos/asanikushin/hash_table/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/asanikushin/hash_table/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/asanikushin/hash_table/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/asanikushin/hash_table/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/asanikushin/hash_table/statuses/0789d1ee97bca59765b7ba4d3b20a89732e333b3"}},"author_association":"OWNER"}}
{"actor":{"display_login":"danlark1"}}