{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/GSL/issues/395","repository_url":"https://api.github.com/repos/Microsoft/GSL","labels_url":"https://api.github.com/repos/Microsoft/GSL/issues/395/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/GSL/issues/395/comments","events_url":"https://api.github.com/repos/Microsoft/GSL/issues/395/events","html_url":"https://github.com/Microsoft/GSL/issues/395","id":182513061,"number":395,"title":"not_null has converting constructors?","user":{"login":"akrzemi1","id":2912717,"avatar_url":"https://avatars.githubusercontent.com/u/2912717?v=3","gravatar_id":"","url":"https://api.github.com/users/akrzemi1","html_url":"https://github.com/akrzemi1","followers_url":"https://api.github.com/users/akrzemi1/followers","following_url":"https://api.github.com/users/akrzemi1/following{/other_user}","gists_url":"https://api.github.com/users/akrzemi1/gists{/gist_id}","starred_url":"https://api.github.com/users/akrzemi1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akrzemi1/subscriptions","organizations_url":"https://api.github.com/users/akrzemi1/orgs","repos_url":"https://api.github.com/users/akrzemi1/repos","events_url":"https://api.github.com/users/akrzemi1/events{/privacy}","received_events_url":"https://api.github.com/users/akrzemi1/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/GSL/labels/open","name":"open","color":"5319e7"}],"state":"open","locked":false,"assignee":{"login":"neilmacintosh","id":10985489,"avatar_url":"https://avatars.githubusercontent.com/u/10985489?v=3","gravatar_id":"","url":"https://api.github.com/users/neilmacintosh","html_url":"https://github.com/neilmacintosh","followers_url":"https://api.github.com/users/neilmacintosh/followers","following_url":"https://api.github.com/users/neilmacintosh/following{/other_user}","gists_url":"https://api.github.com/users/neilmacintosh/gists{/gist_id}","starred_url":"https://api.github.com/users/neilmacintosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilmacintosh/subscriptions","organizations_url":"https://api.github.com/users/neilmacintosh/orgs","repos_url":"https://api.github.com/users/neilmacintosh/repos","events_url":"https://api.github.com/users/neilmacintosh/events{/privacy}","received_events_url":"https://api.github.com/users/neilmacintosh/received_events","type":"User","site_admin":false},"assignees":[{"login":"neilmacintosh","id":10985489,"avatar_url":"https://avatars.githubusercontent.com/u/10985489?v=3","gravatar_id":"","url":"https://api.github.com/users/neilmacintosh","html_url":"https://github.com/neilmacintosh","followers_url":"https://api.github.com/users/neilmacintosh/followers","following_url":"https://api.github.com/users/neilmacintosh/following{/other_user}","gists_url":"https://api.github.com/users/neilmacintosh/gists{/gist_id}","starred_url":"https://api.github.com/users/neilmacintosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilmacintosh/subscriptions","organizations_url":"https://api.github.com/users/neilmacintosh/orgs","repos_url":"https://api.github.com/users/neilmacintosh/repos","events_url":"https://api.github.com/users/neilmacintosh/events{/privacy}","received_events_url":"https://api.github.com/users/neilmacintosh/received_events","type":"User","site_admin":false}],"milestone":null,"comments":7,"created_at":"2016-10-12T12:30:17Z","updated_at":"2016-10-24T16:40:18Z","closed_at":null,"body":"It seems to me that offering a conversion from `T` to `not_null<T>` looses the potential to detect certain bugs at compile-time.\r\n\r\nif I have a function that returns a raw (potentially null) pointer, and I carelessly pass it to a function taking not_null it will compile fine, and will try report a bug at run-time when it is likely too late.\r\n\r\nInstead, if the constructor from `T` were explicit, an inadvertent assignment:\r\n\r\n```c++\r\nuse_ptr(make_ptr());\r\n```\r\nwould be impossible, and I would be forced to explicitly require a potentially unsafe conversion:\r\n\r\n```c++\r\nuse_ptr(not_null<T>{make_ptr()});\r\n```\r\nThis would be a kind of the signature: by writing this cast, I am taking the responsibility for guaranteeing that the raw pointer will not be null. If it is not the case, you will know that I did it consciously.\r\n\r\nSee also CppCoreGuidelines issue: https://github.com/isocpp/CppCoreGuidelines/issues/767"},"comment":{"url":"https://api.github.com/repos/Microsoft/GSL/issues/comments/255794899","html_url":"https://github.com/Microsoft/GSL/issues/395#issuecomment-255794899","issue_url":"https://api.github.com/repos/Microsoft/GSL/issues/395","id":255794899,"user":{"login":"neilmacintosh","id":10985489,"avatar_url":"https://avatars.githubusercontent.com/u/10985489?v=3","gravatar_id":"","url":"https://api.github.com/users/neilmacintosh","html_url":"https://github.com/neilmacintosh","followers_url":"https://api.github.com/users/neilmacintosh/followers","following_url":"https://api.github.com/users/neilmacintosh/following{/other_user}","gists_url":"https://api.github.com/users/neilmacintosh/gists{/gist_id}","starred_url":"https://api.github.com/users/neilmacintosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilmacintosh/subscriptions","organizations_url":"https://api.github.com/users/neilmacintosh/orgs","repos_url":"https://api.github.com/users/neilmacintosh/repos","events_url":"https://api.github.com/users/neilmacintosh/events{/privacy}","received_events_url":"https://api.github.com/users/neilmacintosh/received_events","type":"User","site_admin":false},"created_at":"2016-10-24T16:40:18Z","updated_at":"2016-10-24T16:40:18Z","body":"@akrzemi1 I just noticed that you had provided a PR, sorry! It looks as though it's failing the automated checks at the moment...could you fix that up? Then I can take a look ;-)"}}
{"actor":{"display_login":"neilmacintosh"}}