{"action":"created","comment":{"url":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/comments/216618082","pull_request_review_id":154137020,"id":216618082,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjYxODA4Mg==","diff_hunk":"@@ -0,0 +1,235 @@\n+#pragma once\n+\n+//todo: doxygen\n+\n+#include <vector>\n+#include <algorithm>\n+#include <map>\n+\n+template <\n+  class Key, \n+  class T,\n+  class Allocator = std::allocator<std::pair<Key, T>>\n+>\n+class flat_map {\n+public:\n+  using key_type               = Key;\n+  using mapped_type            = T;\n+  using value_type             = std::pair<Key, T>;\n+  using vector_type            = std::vector<value_type, Allocator>;\n+  using allocator_type         = typename vector_type::allocator_type;\n+  using size_type              = typename vector_type::size_type;\n+  using difference_type        = typename vector_type::difference_type;\n+  using reference              = typename vector_type::reference;\n+  using const_reference        = typename vector_type::const_reference;\n+  using pointer                = typename vector_type::pointer;\n+  using const_pointer          = typename vector_type::const_pointer;\n+  using iterator               = typename vector_type::iterator;\n+  using const_iterator         = typename vector_type::const_iterator;\n+  using reverse_iterator       = typename vector_type::reverse_iterator;\n+  using const_reverse_iterator = typename vector_type::const_reverse_iterator;\n+\n+  flat_map() noexcept = default;\n+\n+  ~flat_map() noexcept = default;\n+\n+  flat_map(const vector_type& r) noexcept\n+    : cache_(r)\n+  { }\n+\n+  flat_map(std::initializer_list<value_type> l) noexcept\n+    : cache_(l)\n+  { }\n+\n+  template <class InputIterator>\n+  flat_map(InputIterator first, InputIterator last) {\n+    cache_.insert(cache_.end(), first, last);\n+  }\n+\n+  iterator begin() noexcept {\n+    return cache_.begin();\n+  }\n+\n+  const_iterator begin() const noexcept {\n+    return cache_.begin();\n+  }\n+\n+  const_iterator cbegin() const noexcept {\n+    return cache_.cbegin();\n+  }\n+\n+  reverse_iterator rbegin() noexcept {\n+    return cache_.rbegin();\n+  }\n+\n+  const_reverse_iterator rbegin() const noexcept {\n+    return cache_.rbegin();\n+  }\n+\n+  iterator end() noexcept {\n+    return cache_.end();\n+  }\n+\n+  const_iterator end() const noexcept {\n+    return cache_.end();\n+  }\n+\n+  const_iterator cend() const noexcept {\n+    return cache_.cend();\n+  }\n+\n+  reverse_iterator rend() noexcept {\n+    return cache_.rend();\n+  }\n+\n+  const_reverse_iterator rend() const noexcept {\n+    return cache_.rend();\n+  }\n+\n+  bool empty() const noexcept {\n+    return cache_.empty();\n+  }\n+\n+  size_type size() const noexcept {\n+    return cache_.size();\n+  }\n+\n+  void reserve(size_type count) {\n+    cache_.reserve(count);\n+  }\n+\n+  void shrink_to_fit() {\n+    cache_.shrink_to_fit();\n+  }\n+\n+  vector_type& container() noexcept {\n+    return cache_;\n+  }\n+\n+  const vector_type& container() const noexcept {\n+    return cache_;\n+  }\n+\n+  void clear() noexcept {\n+    cache_.clear();\n+  }\n+\n+  void swap(flat_map& other) {\n+    cache_.swap( other.cache_ );\n+  }\n+\n+  std::pair<iterator, bool> insert(value_type x) {\n+    for(auto it = cache_.begin(); it != cache_.end(); ++it)\n+      if(*it == x)\n+        return std::pair<iterator, bool>( it, false ); //already exists\n+    return std::pair<iterator, bool>( cache_.insert(cache_.end(), x), true ); //inserted\n+  }\n+\n+  iterator insert(iterator hint, value_type x) {\n+    return cache_.insert(cache_.end(), x); //should be optimized with the hint\n+  }\n+\n+  iterator insert(const_iterator hint, value_type x) {\n+    return cache_.insert(cache_.end(), x); //should be optimized with the hint\n+  }\n+\n+  template <class InputIterator>\n+  void insert(InputIterator first, InputIterator last) {\n+    for(auto it = first; it != last; ++it)\n+      cache_.insert( cache_.end(), *it );\n+  }\n+\n+  template <class... Ts>\n+  std::pair<iterator, bool> emplace(Ts&&... xs) {\n+    const iterator &emplaced = cache_.emplace(cache_.end(), std::forward<Ts>(xs)...);","path":"core/actor-zeta/flat_map.hpp","position":144,"original_position":144,"commit_id":"72fa63d21cb7ad18ff958778e4cf7942dc5a7b78","original_commit_id":"72fa63d21cb7ad18ff958778e4cf7942dc5a7b78","user":{"login":"kotbegemot","id":958279,"node_id":"MDQ6VXNlcjk1ODI3OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/958279?v=4","gravatar_id":"","url":"https://api.github.com/users/kotbegemot","html_url":"https://github.com/kotbegemot","followers_url":"https://api.github.com/users/kotbegemot/followers","following_url":"https://api.github.com/users/kotbegemot/following{/other_user}","gists_url":"https://api.github.com/users/kotbegemot/gists{/gist_id}","starred_url":"https://api.github.com/users/kotbegemot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kotbegemot/subscriptions","organizations_url":"https://api.github.com/users/kotbegemot/orgs","repos_url":"https://api.github.com/users/kotbegemot/repos","events_url":"https://api.github.com/users/kotbegemot/events{/privacy}","received_events_url":"https://api.github.com/users/kotbegemot/received_events","type":"User","site_admin":false},"body":"Why not using a method insert ?","created_at":"2018-09-11T10:19:31Z","updated_at":"2018-09-11T10:19:35Z","html_url":"https://github.com/smart-cloud/actor-zeta/pull/32#discussion_r216618082","pull_request_url":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/32","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/comments/216618082"},"html":{"href":"https://github.com/smart-cloud/actor-zeta/pull/32#discussion_r216618082"},"pull_request":{"href":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/32","id":214050751,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MDUwNzUx","html_url":"https://github.com/smart-cloud/actor-zeta/pull/32","diff_url":"https://github.com/smart-cloud/actor-zeta/pull/32.diff","patch_url":"https://github.com/smart-cloud/actor-zeta/pull/32.patch","issue_url":"https://api.github.com/repos/smart-cloud/actor-zeta/issues/32","number":32,"state":"open","locked":false,"title":"24 flat map","user":{"login":"petrovigor","id":8223632,"node_id":"MDQ6VXNlcjgyMjM2MzI=","avatar_url":"https://avatars2.githubusercontent.com/u/8223632?v=4","gravatar_id":"","url":"https://api.github.com/users/petrovigor","html_url":"https://github.com/petrovigor","followers_url":"https://api.github.com/users/petrovigor/followers","following_url":"https://api.github.com/users/petrovigor/following{/other_user}","gists_url":"https://api.github.com/users/petrovigor/gists{/gist_id}","starred_url":"https://api.github.com/users/petrovigor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrovigor/subscriptions","organizations_url":"https://api.github.com/users/petrovigor/orgs","repos_url":"https://api.github.com/users/petrovigor/repos","events_url":"https://api.github.com/users/petrovigor/events{/privacy}","received_events_url":"https://api.github.com/users/petrovigor/received_events","type":"User","site_admin":false},"body":"- fully-implemented base functional of flat-map\r\n- created tests for all base implementation\r\n","created_at":"2018-09-07T22:08:22Z","updated_at":"2018-09-11T10:19:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb8feca8d98ce82268033c83f219af9c91535b34","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/32/commits","review_comments_url":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/32/comments","review_comment_url":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/smart-cloud/actor-zeta/issues/32/comments","statuses_url":"https://api.github.com/repos/smart-cloud/actor-zeta/statuses/72fa63d21cb7ad18ff958778e4cf7942dc5a7b78","head":{"label":"smart-cloud:24-flat-map","ref":"24-flat-map","sha":"72fa63d21cb7ad18ff958778e4cf7942dc5a7b78","user":{"login":"smart-cloud","id":16237574,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MjM3NTc0","avatar_url":"https://avatars2.githubusercontent.com/u/16237574?v=4","gravatar_id":"","url":"https://api.github.com/users/smart-cloud","html_url":"https://github.com/smart-cloud","followers_url":"https://api.github.com/users/smart-cloud/followers","following_url":"https://api.github.com/users/smart-cloud/following{/other_user}","gists_url":"https://api.github.com/users/smart-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/smart-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smart-cloud/subscriptions","organizations_url":"https://api.github.com/users/smart-cloud/orgs","repos_url":"https://api.github.com/users/smart-cloud/repos","events_url":"https://api.github.com/users/smart-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/smart-cloud/received_events","type":"Organization","site_admin":false},"repo":{"id":47886502,"node_id":"MDEwOlJlcG9zaXRvcnk0Nzg4NjUwMg==","name":"actor-zeta","full_name":"smart-cloud/actor-zeta","owner":{"login":"smart-cloud","id":16237574,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MjM3NTc0","avatar_url":"https://avatars2.githubusercontent.com/u/16237574?v=4","gravatar_id":"","url":"https://api.github.com/users/smart-cloud","html_url":"https://github.com/smart-cloud","followers_url":"https://api.github.com/users/smart-cloud/followers","following_url":"https://api.github.com/users/smart-cloud/following{/other_user}","gists_url":"https://api.github.com/users/smart-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/smart-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smart-cloud/subscriptions","organizations_url":"https://api.github.com/users/smart-cloud/orgs","repos_url":"https://api.github.com/users/smart-cloud/repos","events_url":"https://api.github.com/users/smart-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/smart-cloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/smart-cloud/actor-zeta","description":"Library that provides an actor style message-passing programming model (in C++).","fork":false,"url":"https://api.github.com/repos/smart-cloud/actor-zeta","forks_url":"https://api.github.com/repos/smart-cloud/actor-zeta/forks","keys_url":"https://api.github.com/repos/smart-cloud/actor-zeta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smart-cloud/actor-zeta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smart-cloud/actor-zeta/teams","hooks_url":"https://api.github.com/repos/smart-cloud/actor-zeta/hooks","issue_events_url":"https://api.github.com/repos/smart-cloud/actor-zeta/issues/events{/number}","events_url":"https://api.github.com/repos/smart-cloud/actor-zeta/events","assignees_url":"https://api.github.com/repos/smart-cloud/actor-zeta/assignees{/user}","branches_url":"https://api.github.com/repos/smart-cloud/actor-zeta/branches{/branch}","tags_url":"https://api.github.com/repos/smart-cloud/actor-zeta/tags","blobs_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/refs{/sha}","trees_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smart-cloud/actor-zeta/statuses/{sha}","languages_url":"https://api.github.com/repos/smart-cloud/actor-zeta/languages","stargazers_url":"https://api.github.com/repos/smart-cloud/actor-zeta/stargazers","contributors_url":"https://api.github.com/repos/smart-cloud/actor-zeta/contributors","subscribers_url":"https://api.github.com/repos/smart-cloud/actor-zeta/subscribers","subscription_url":"https://api.github.com/repos/smart-cloud/actor-zeta/subscription","commits_url":"https://api.github.com/repos/smart-cloud/actor-zeta/commits{/sha}","git_commits_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/commits{/sha}","comments_url":"https://api.github.com/repos/smart-cloud/actor-zeta/comments{/number}","issue_comment_url":"https://api.github.com/repos/smart-cloud/actor-zeta/issues/comments{/number}","contents_url":"https://api.github.com/repos/smart-cloud/actor-zeta/contents/{+path}","compare_url":"https://api.github.com/repos/smart-cloud/actor-zeta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smart-cloud/actor-zeta/merges","archive_url":"https://api.github.com/repos/smart-cloud/actor-zeta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smart-cloud/actor-zeta/downloads","issues_url":"https://api.github.com/repos/smart-cloud/actor-zeta/issues{/number}","pulls_url":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls{/number}","milestones_url":"https://api.github.com/repos/smart-cloud/actor-zeta/milestones{/number}","notifications_url":"https://api.github.com/repos/smart-cloud/actor-zeta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smart-cloud/actor-zeta/labels{/name}","releases_url":"https://api.github.com/repos/smart-cloud/actor-zeta/releases{/id}","deployments_url":"https://api.github.com/repos/smart-cloud/actor-zeta/deployments","created_at":"2015-12-12T16:59:57Z","updated_at":"2018-09-05T14:13:09Z","pushed_at":"2018-09-10T23:19:38Z","git_url":"git://github.com/smart-cloud/actor-zeta.git","ssh_url":"git@github.com:smart-cloud/actor-zeta.git","clone_url":"https://github.com/smart-cloud/actor-zeta.git","svn_url":"https://github.com/smart-cloud/actor-zeta","homepage":null,"size":251,"stargazers_count":9,"watchers_count":9,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":3,"open_issues":16,"watchers":9,"default_branch":"master"}},"base":{"label":"smart-cloud:master","ref":"master","sha":"3af691f2562cbfe4be8240948a2b13adb9445077","user":{"login":"smart-cloud","id":16237574,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MjM3NTc0","avatar_url":"https://avatars2.githubusercontent.com/u/16237574?v=4","gravatar_id":"","url":"https://api.github.com/users/smart-cloud","html_url":"https://github.com/smart-cloud","followers_url":"https://api.github.com/users/smart-cloud/followers","following_url":"https://api.github.com/users/smart-cloud/following{/other_user}","gists_url":"https://api.github.com/users/smart-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/smart-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smart-cloud/subscriptions","organizations_url":"https://api.github.com/users/smart-cloud/orgs","repos_url":"https://api.github.com/users/smart-cloud/repos","events_url":"https://api.github.com/users/smart-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/smart-cloud/received_events","type":"Organization","site_admin":false},"repo":{"id":47886502,"node_id":"MDEwOlJlcG9zaXRvcnk0Nzg4NjUwMg==","name":"actor-zeta","full_name":"smart-cloud/actor-zeta","owner":{"login":"smart-cloud","id":16237574,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MjM3NTc0","avatar_url":"https://avatars2.githubusercontent.com/u/16237574?v=4","gravatar_id":"","url":"https://api.github.com/users/smart-cloud","html_url":"https://github.com/smart-cloud","followers_url":"https://api.github.com/users/smart-cloud/followers","following_url":"https://api.github.com/users/smart-cloud/following{/other_user}","gists_url":"https://api.github.com/users/smart-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/smart-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smart-cloud/subscriptions","organizations_url":"https://api.github.com/users/smart-cloud/orgs","repos_url":"https://api.github.com/users/smart-cloud/repos","events_url":"https://api.github.com/users/smart-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/smart-cloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/smart-cloud/actor-zeta","description":"Library that provides an actor style message-passing programming model (in C++).","fork":false,"url":"https://api.github.com/repos/smart-cloud/actor-zeta","forks_url":"https://api.github.com/repos/smart-cloud/actor-zeta/forks","keys_url":"https://api.github.com/repos/smart-cloud/actor-zeta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smart-cloud/actor-zeta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smart-cloud/actor-zeta/teams","hooks_url":"https://api.github.com/repos/smart-cloud/actor-zeta/hooks","issue_events_url":"https://api.github.com/repos/smart-cloud/actor-zeta/issues/events{/number}","events_url":"https://api.github.com/repos/smart-cloud/actor-zeta/events","assignees_url":"https://api.github.com/repos/smart-cloud/actor-zeta/assignees{/user}","branches_url":"https://api.github.com/repos/smart-cloud/actor-zeta/branches{/branch}","tags_url":"https://api.github.com/repos/smart-cloud/actor-zeta/tags","blobs_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/refs{/sha}","trees_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smart-cloud/actor-zeta/statuses/{sha}","languages_url":"https://api.github.com/repos/smart-cloud/actor-zeta/languages","stargazers_url":"https://api.github.com/repos/smart-cloud/actor-zeta/stargazers","contributors_url":"https://api.github.com/repos/smart-cloud/actor-zeta/contributors","subscribers_url":"https://api.github.com/repos/smart-cloud/actor-zeta/subscribers","subscription_url":"https://api.github.com/repos/smart-cloud/actor-zeta/subscription","commits_url":"https://api.github.com/repos/smart-cloud/actor-zeta/commits{/sha}","git_commits_url":"https://api.github.com/repos/smart-cloud/actor-zeta/git/commits{/sha}","comments_url":"https://api.github.com/repos/smart-cloud/actor-zeta/comments{/number}","issue_comment_url":"https://api.github.com/repos/smart-cloud/actor-zeta/issues/comments{/number}","contents_url":"https://api.github.com/repos/smart-cloud/actor-zeta/contents/{+path}","compare_url":"https://api.github.com/repos/smart-cloud/actor-zeta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smart-cloud/actor-zeta/merges","archive_url":"https://api.github.com/repos/smart-cloud/actor-zeta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smart-cloud/actor-zeta/downloads","issues_url":"https://api.github.com/repos/smart-cloud/actor-zeta/issues{/number}","pulls_url":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls{/number}","milestones_url":"https://api.github.com/repos/smart-cloud/actor-zeta/milestones{/number}","notifications_url":"https://api.github.com/repos/smart-cloud/actor-zeta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smart-cloud/actor-zeta/labels{/name}","releases_url":"https://api.github.com/repos/smart-cloud/actor-zeta/releases{/id}","deployments_url":"https://api.github.com/repos/smart-cloud/actor-zeta/deployments","created_at":"2015-12-12T16:59:57Z","updated_at":"2018-09-05T14:13:09Z","pushed_at":"2018-09-10T23:19:38Z","git_url":"git://github.com/smart-cloud/actor-zeta.git","ssh_url":"git@github.com:smart-cloud/actor-zeta.git","clone_url":"https://github.com/smart-cloud/actor-zeta.git","svn_url":"https://github.com/smart-cloud/actor-zeta","homepage":null,"size":251,"stargazers_count":9,"watchers_count":9,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":3,"open_issues":16,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/32"},"html":{"href":"https://github.com/smart-cloud/actor-zeta/pull/32"},"issue":{"href":"https://api.github.com/repos/smart-cloud/actor-zeta/issues/32"},"comments":{"href":"https://api.github.com/repos/smart-cloud/actor-zeta/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/smart-cloud/actor-zeta/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/smart-cloud/actor-zeta/statuses/72fa63d21cb7ad18ff958778e4cf7942dc5a7b78"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kotbegemot"}}