{"action":"created","issue":{"url":"https://api.github.com/repos/ericniebler/stl2/issues/38","labels_url":"https://api.github.com/repos/ericniebler/stl2/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/ericniebler/stl2/issues/38/comments","events_url":"https://api.github.com/repos/ericniebler/stl2/issues/38/events","html_url":"https://github.com/ericniebler/stl2/issues/38","id":83622183,"number":38,"title":"Should Semiregular impose copy-indenpendence?","user":{"login":"tomaszkam","id":4975640,"avatar_url":"https://avatars.githubusercontent.com/u/4975640?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaszkam","html_url":"https://github.com/tomaszkam","followers_url":"https://api.github.com/users/tomaszkam/followers","following_url":"https://api.github.com/users/tomaszkam/following{/other_user}","gists_url":"https://api.github.com/users/tomaszkam/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaszkam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaszkam/subscriptions","organizations_url":"https://api.github.com/users/tomaszkam/orgs","repos_url":"https://api.github.com/users/tomaszkam/repos","events_url":"https://api.github.com/users/tomaszkam/events{/privacy}","received_events_url":"https://api.github.com/users/tomaszkam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":42,"created_at":"2015-06-01T17:52:02Z","updated_at":"2015-06-08T20:10:48Z","closed_at":null,"body":"I am creating a separate topic for the issue that was mentioned during discussion about `reference_wrapper<I>` in the topic [https://github.com/ericniebler/stl2/issues/23](algorithm return types should maybe drop pair and tuple in favor of structs with more meaningful field names #23).\r\n\r\nThe question is whether the `Semiregular` concept requires the copy independence, i.e. guarantee that the modification of the copy will not change it source. This may be rephrased into the question if `SemiRegular` types should have value semantics or they are allowed to expose reference semantics.\r\n\r\nThe non normative node placed in the current _Range TS_ on `Semiregular`:\r\n> The `Semiregular` concept is modeled by types that have behave similarly to built-in types like\r\nint, except that they may not be comparable with `==`. \r\nSuggest that the types that meets this concept should provide value like semantics (like `int`).\r\n\r\nFrom the other side requiring copy independence from `Semiregular` would break input/output iterators (as pointed by _CaseyCarter_). However I think that the problem should be solved by removing `Semiregular` concept from `WeaklyImplementable`. I believe that such types should not be required to be `CopyConstructible`, because copying the value of the iterator to save current position is undefined for this type of objects, so no algorithm that accepts  these type of iterator needs to create a copy of iterator. To pass is argument to function/return, move operation would be sufficient,\r\n\r\nFurthermore copy constructor of `std::istream_iterator` behaves similarly to `std::auto_ptr`- after copy only one of the objects may be used. I think that similar shift like the one in case of std::unique_ptr could be also applied here, which will clearly suggest that now move-from (copied-from before) iterator is not valid.\r\n\r\nIn conclusion I am suggesting to add copy independence requirements to `SemiRegular` as semantics requirement. And reduce requirement for  `WeaklyImplementable` to `Moveable` and `DefaultConstrutible`."},"comment":{"url":"https://api.github.com/repos/ericniebler/stl2/issues/comments/110123316","html_url":"https://github.com/ericniebler/stl2/issues/38#issuecomment-110123316","issue_url":"https://api.github.com/repos/ericniebler/stl2/issues/38","id":110123316,"user":{"login":"sean-parent","id":2279724,"avatar_url":"https://avatars.githubusercontent.com/u/2279724?v=3","gravatar_id":"","url":"https://api.github.com/users/sean-parent","html_url":"https://github.com/sean-parent","followers_url":"https://api.github.com/users/sean-parent/followers","following_url":"https://api.github.com/users/sean-parent/following{/other_user}","gists_url":"https://api.github.com/users/sean-parent/gists{/gist_id}","starred_url":"https://api.github.com/users/sean-parent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sean-parent/subscriptions","organizations_url":"https://api.github.com/users/sean-parent/orgs","repos_url":"https://api.github.com/users/sean-parent/repos","events_url":"https://api.github.com/users/sean-parent/events{/privacy}","received_events_url":"https://api.github.com/users/sean-parent/received_events","type":"User","site_admin":false},"created_at":"2015-06-08T20:10:48Z","updated_at":"2015-06-08T20:10:48Z","body":"If it is copyable in any form then copies must be independent.\n\nOn Mon, Jun 8, 2015 at 12:15 PM, Andrew Sutton <notifications@github.com>\nwrote:\n\n> I thought that functions in n3351 and the ranges TS were semiregular,\n> but apparently only copy constructible and destructible. Apparently I\n> was mistaken.\n>\n> I want to see concrete examples where postconditions are broken when we\n> don't\n> have copy independence. I was trying to craft one, but it's not\n> working out so well.\n>\n> Andrew Sutton\n>\n>\n>\n> On Mon, Jun 8, 2015 at 2:50 PM, Eric Niebler <notifications@github.com>\n> wrote:\n> > Neither are function objects, and yet both lambdas and function objects\n> are\n> > expected to be Semiregular.\n> >\n> > Who expects that? In what context?\n> >\n> > —\n> > Reply to this email directly or view it on GitHub.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/ericniebler/stl2/issues/38#issuecomment-110111098>.\n>\n"}}