{"action":"closed","issue":{"url":"https://api.github.com/repos/Keno/Cxx.jl/issues/194","labels_url":"https://api.github.com/repos/Keno/Cxx.jl/issues/194/labels{/name}","comments_url":"https://api.github.com/repos/Keno/Cxx.jl/issues/194/comments","events_url":"https://api.github.com/repos/Keno/Cxx.jl/issues/194/events","html_url":"https://github.com/Keno/Cxx.jl/issues/194","id":115357652,"number":194,"title":"Dereferencing pointers in @cxx method calls","user":{"login":"vglazer","id":2404869,"avatar_url":"https://avatars.githubusercontent.com/u/2404869?v=3","gravatar_id":"","url":"https://api.github.com/users/vglazer","html_url":"https://github.com/vglazer","followers_url":"https://api.github.com/users/vglazer/followers","following_url":"https://api.github.com/users/vglazer/following{/other_user}","gists_url":"https://api.github.com/users/vglazer/gists{/gist_id}","starred_url":"https://api.github.com/users/vglazer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vglazer/subscriptions","organizations_url":"https://api.github.com/users/vglazer/orgs","repos_url":"https://api.github.com/users/vglazer/repos","events_url":"https://api.github.com/users/vglazer/events{/privacy}","received_events_url":"https://api.github.com/users/vglazer/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-05T19:36:57Z","updated_at":"2015-11-05T19:50:21Z","closed_at":"2015-11-05T19:50:21Z","body":"I have two classes, `A` and `B`. `B` has a method called `f()` whose signature looks like this:\r\n\r\n```c++\r\ndouble B::f(const A & a1, const A & a2) const;\r\n```\r\n\r\nI'd like to be able to do something like this:\r\n\r\n```julia\r\nusing Cxx\r\n\r\na1 = @cxxnew A()\r\na2 = @cxxnew A()\r\nb = @cxxnew B()\r\n\r\nval = @cxx b->f(*a1, *a2)\r\n```\r\n\r\nUnfortunately, this fails with the following error:\r\n\r\n```\r\nERROR: LoadError: syntax: \"*\" is not a unary operator\r\n in include at ./boot.jl:261\r\n in include_from_node1 at ./loading.jl:304\r\n in process_options at ./client.jl:308\r\n in _start at ./client.jl:411\r\n```\r\n\r\nOne workaround is to introduce a templated method called `get_ref()` which looks like this:\r\n\r\n```julia\r\ncxx\"\"\"\r\n    template<typename T>\r\n    T & get_ref(T * t)\r\n    {\r\n        return *t;\r\n    }\r\n\"\"\"\r\n```\r\n\r\nWith this kludge, the following works as expected:\r\n\r\n```julia\r\na1_ref = @cxx get_ref(a1)\r\na2_ref = @cxx get_ref(a2)\r\nvalue = @cxx b->f(a1_ref, a2_ref)\r\n```\r\n\r\nThe above approach isn't very satisfying though. Is there a better way to deal with situations like this in the current implementation? \r\n\r\nSWIG has some special magic for handling such things, for example:\r\nhttp://www.swig.org/Doc1.3/SWIGPlus.html#SWIGPlus_nn18\r\n"}}