{"action":"opened","issue":{"url":"https://api.github.com/repos/ecorm/cppwamp/issues/87","labels_url":"https://api.github.com/repos/ecorm/cppwamp/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/ecorm/cppwamp/issues/87/comments","events_url":"https://api.github.com/repos/ecorm/cppwamp/issues/87/events","html_url":"https://github.com/ecorm/cppwamp/issues/87","id":114260610,"number":87,"title":"Improve scoped registration example","user":{"login":"estan","id":86675,"avatar_url":"https://avatars.githubusercontent.com/u/86675?v=3","gravatar_id":"","url":"https://api.github.com/users/estan","html_url":"https://github.com/estan","followers_url":"https://api.github.com/users/estan/followers","following_url":"https://api.github.com/users/estan/following{/other_user}","gists_url":"https://api.github.com/users/estan/gists{/gist_id}","starred_url":"https://api.github.com/users/estan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estan/subscriptions","organizations_url":"https://api.github.com/users/estan/orgs","repos_url":"https://api.github.com/users/estan/repos","events_url":"https://api.github.com/users/estan/events{/privacy}","received_events_url":"https://api.github.com/users/estan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-30T12:29:00Z","updated_at":"2015-10-30T12:29:00Z","closed_at":null,"body":"I was looking at the scoped registration example in the tutorial (and reference docs):\r\n\r\n```cpp\r\nstruct Delegate\r\n{\r\n    Outcome rpc(Invocation inv);\r\n\r\n    ScopedRegistration reg;\r\n}\r\n\r\nint main()\r\n{\r\n    boost::asio::io_service iosvc;\r\n    boost::asio::spawn(iosvc, [&](boost::asio::yield_context yield)\r\n    {\r\n        auto session = CoroSession<>::create(connectorList);\r\n        session->connect(yield);\r\n        session->join(\"somerealm\", yield);\r\n\r\n        {\r\n            using std::placeholders;\r\n            Delegate delegate;\r\n            delegate.reg = session->enroll(\r\n                            Procedure(\"someprocedure\"),\r\n                            std::bind(&Delegate::rpc, delegate, _1),\r\n                            yield);\r\n\r\n        }  // When the 'delegate' object leaves this scope, its\r\n           // ScopedRegisration member gets destroyed. This will\r\n           // automatically unregister the regisration, thereby avoiding\r\n           // further member function calls on the deleted 'delegate'\r\n           // object.\r\n    });\r\n    iosvc.run();\r\n}\r\n```\r\n\r\nCorrect me if I'm wrong, but will this not register the slot and then almost immediately unregister it when the scope is exited? If so, could the example be made more realistic without complicating it too much? If not, please set me straight on what happens :)"}}