{"action":"created","issue":{"url":"https://api.github.com/repos/nim-lang/c2nim/issues/60","repository_url":"https://api.github.com/repos/nim-lang/c2nim","labels_url":"https://api.github.com/repos/nim-lang/c2nim/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/c2nim/issues/60/comments","events_url":"https://api.github.com/repos/nim-lang/c2nim/issues/60/events","html_url":"https://github.com/nim-lang/c2nim/issues/60","id":123200073,"number":60,"title":"CPP Operator pointers","user":{"login":"jlp765","id":5141524,"avatar_url":"https://avatars.githubusercontent.com/u/5141524?v=3","gravatar_id":"","url":"https://api.github.com/users/jlp765","html_url":"https://github.com/jlp765","followers_url":"https://api.github.com/users/jlp765/followers","following_url":"https://api.github.com/users/jlp765/following{/other_user}","gists_url":"https://api.github.com/users/jlp765/gists{/gist_id}","starred_url":"https://api.github.com/users/jlp765/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlp765/subscriptions","organizations_url":"https://api.github.com/users/jlp765/orgs","repos_url":"https://api.github.com/users/jlp765/repos","events_url":"https://api.github.com/users/jlp765/events{/privacy}","received_events_url":"https://api.github.com/users/jlp765/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2015-12-21T02:40:15Z","updated_at":"2016-09-24T18:59:35Z","closed_at":null,"body":"The following fails with\r\n``Error: identifier expected, but found '*'``\r\n\r\nfor ``c2nim --cpp `` conversion of\r\n```\r\nclass failClass1 {\r\npublic:\r\n  int tmpI;\r\n  operator MyOp1() { return tmpI; }\r\n  operator MyOp2*() { return *tmpI; }   // <- this fails, for MyOp2*()\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/nim-lang/c2nim/issues/comments/249381502","html_url":"https://github.com/nim-lang/c2nim/issues/60#issuecomment-249381502","issue_url":"https://api.github.com/repos/nim-lang/c2nim/issues/60","id":249381502,"user":{"login":"cjhanks","id":1406887,"avatar_url":"https://avatars.githubusercontent.com/u/1406887?v=3","gravatar_id":"","url":"https://api.github.com/users/cjhanks","html_url":"https://github.com/cjhanks","followers_url":"https://api.github.com/users/cjhanks/followers","following_url":"https://api.github.com/users/cjhanks/following{/other_user}","gists_url":"https://api.github.com/users/cjhanks/gists{/gist_id}","starred_url":"https://api.github.com/users/cjhanks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjhanks/subscriptions","organizations_url":"https://api.github.com/users/cjhanks/orgs","repos_url":"https://api.github.com/users/cjhanks/repos","events_url":"https://api.github.com/users/cjhanks/events{/privacy}","received_events_url":"https://api.github.com/users/cjhanks/received_events","type":"User","site_admin":false},"created_at":"2016-09-24T18:59:35Z","updated_at":"2016-09-24T18:59:35Z","body":"Typically `operator*` is paired with `operator->` when a class is responsible for managing internal data; `unique_ptr`, `shared_ptr`.\r\n\r\nIt typically means dereference the internal point and pass me the reference.\r\n\r\nExample:\r\n``` cpp\r\n\r\nclass Example {\r\npublic:\r\n  struct Element {\r\n    int a;\r\n    int b;\r\n  };\r\n\r\n  Element*\r\n  operator->() {\r\n    return &e;\r\n  }\r\n\r\n  Element&\r\n  operator*() {\r\n    return e;\r\n  }\r\n\r\nprivate:\r\n      Element e;\r\n};\r\n\r\n\r\nvoid\r\nFunction(Example::Element& element) {\r\n  element.a = 4;\r\n}\r\n\r\nint\r\nmain()\r\n{\r\n  Example example;\r\n  example->a = 3;\r\n\r\n  Function(*example);\r\n}\r\n```"}}
{"actor":{"display_login":"cjhanks"}}