{"action":"created","issue":{"url":"https://api.github.com/repos/DGtal-team/DGtal/issues/1151","repository_url":"https://api.github.com/repos/DGtal-team/DGtal","labels_url":"https://api.github.com/repos/DGtal-team/DGtal/issues/1151/labels{/name}","comments_url":"https://api.github.com/repos/DGtal-team/DGtal/issues/1151/comments","events_url":"https://api.github.com/repos/DGtal-team/DGtal/issues/1151/events","html_url":"https://github.com/DGtal-team/DGtal/pull/1151","id":142339918,"number":1151,"title":"Fixing issue #779","user":{"login":"rolanddenis","id":10435058,"avatar_url":"https://avatars.githubusercontent.com/u/10435058?v=3","gravatar_id":"","url":"https://api.github.com/users/rolanddenis","html_url":"https://github.com/rolanddenis","followers_url":"https://api.github.com/users/rolanddenis/followers","following_url":"https://api.github.com/users/rolanddenis/following{/other_user}","gists_url":"https://api.github.com/users/rolanddenis/gists{/gist_id}","starred_url":"https://api.github.com/users/rolanddenis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rolanddenis/subscriptions","organizations_url":"https://api.github.com/users/rolanddenis/orgs","repos_url":"https://api.github.com/users/rolanddenis/repos","events_url":"https://api.github.com/users/rolanddenis/events{/privacy}","received_events_url":"https://api.github.com/users/rolanddenis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/DGtal-team/DGtal/labels/Image","name":"Image","color":"02e10c"},{"url":"https://api.github.com/repos/DGtal-team/DGtal/labels/ready%20for%20review","name":"ready for review","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-21T13:02:10Z","updated_at":"2016-04-10T08:33:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/DGtal-team/DGtal/pulls/1151","html_url":"https://github.com/DGtal-team/DGtal/pull/1151","diff_url":"https://github.com/DGtal-team/DGtal/pull/1151.diff","patch_url":"https://github.com/DGtal-team/DGtal/pull/1151.patch"},"body":"# PR Description\r\n\r\nThe issue #779 comes from the fact that `ImageContainerBySTLMap` stores his domain by pointer.\r\nBut readers create domain on the stack before constructing images so that the pointer is invalid as soon as the reader ends. \r\n\r\nTherefore, a solution is to store the domain by value, like other image containers.\r\nBut, doing so (like in this PR), leads to compilation errors when the domain is not assignable. It is the case when using a `DigitalSetDomain`, like in `tests/geometry/volumes/distance/testPowerMap`.\r\n\r\nIn fact, this problem arises for all `CTrivialConstImage` models that store the domain by value, since it is a refinement of `boost::Assignable`.\r\n\r\nAny suggestion ?\r\n\r\n# Checklist\r\n\r\n- [N/A] Unit-test of your feature with [Catch](http://dgtal.org/doc/stable/moduleCatch.html).\r\n- [N/A] Doxygen documentation of the code completed (classes, methods, types, members...)\r\n- [N/A] Documentation module page added or updated.\r\n- [x] New entry in the [ChangeLog.md](https://github.com/DGtal-team/DGtal/blob/master/ChangeLog.md) added.\r\n- [x] No warning raised in Debug ```cmake``` mode (otherwise, Travis C.I. will fail).\r\n- [x] All continuous integration tests pass (Travis & appveyor)\r\n"},"comment":{"url":"https://api.github.com/repos/DGtal-team/DGtal/issues/comments/207943829","html_url":"https://github.com/DGtal-team/DGtal/pull/1151#issuecomment-207943829","issue_url":"https://api.github.com/repos/DGtal-team/DGtal/issues/1151","id":207943829,"user":{"login":"dcoeurjo","id":700165,"avatar_url":"https://avatars.githubusercontent.com/u/700165?v=3","gravatar_id":"","url":"https://api.github.com/users/dcoeurjo","html_url":"https://github.com/dcoeurjo","followers_url":"https://api.github.com/users/dcoeurjo/followers","following_url":"https://api.github.com/users/dcoeurjo/following{/other_user}","gists_url":"https://api.github.com/users/dcoeurjo/gists{/gist_id}","starred_url":"https://api.github.com/users/dcoeurjo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcoeurjo/subscriptions","organizations_url":"https://api.github.com/users/dcoeurjo/orgs","repos_url":"https://api.github.com/users/dcoeurjo/repos","events_url":"https://api.github.com/users/dcoeurjo/events{/privacy}","received_events_url":"https://api.github.com/users/dcoeurjo/received_events","type":"User","site_admin":false},"created_at":"2016-04-10T08:33:13Z","updated_at":"2016-04-10T08:33:13Z","body":"Sorry for being late on this PR. Let me start with some general comments:\r\n\r\n* all other image containers *should* have their constructor in the form\r\n\r\n````\r\nImageContainer(ConstAlias<Domain> aDomain);\r\n````\r\nand member class could, for instance (several other options are possible as members, see doc page), be:\r\n  \r\n```` \r\nconst Domain * myDomain;\r\n````\r\n(most image containers have been created before Const/Alias stuff). Lifetime of the domain must be larger than the container lifetime (i.e.: no domains on the stack)\r\n\r\n* Thanks to some previous PR, @rolanddenis , if the user does a ```Image image(Domain(a,b))``` an warning should be raised, am I right ? \r\n* Plenty of smart pointers are already available in DGtal, I would recommend to use them\r\n* Heavy/light data management int DGtal is something we have discussed a lot and maybe the solution we have right now is not satisfactory. \r\n* Would you suggest to have both \r\n * a constructor with copy of the domain\r\n * a constructor with an (const) alias of the domain\r\nfor all containers?\r\n\r\nI know that @elcerdo has very different point of view of the data management: constructors always copy the data and when the user don't want to have memory copies, he/she wraps the data into a lightweight facade (with exact same interface)... It is not was is currently implemented in DGtal but that's maybe part of the discussion.\r\n\r\n(ping @JacquesOlivierLachaud )"}}