{"action":"created","issue":{"url":"https://api.github.com/repos/nasa/libSPRITE/issues/3","labels_url":"https://api.github.com/repos/nasa/libSPRITE/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/nasa/libSPRITE/issues/3/comments","events_url":"https://api.github.com/repos/nasa/libSPRITE/issues/3/events","html_url":"https://github.com/nasa/libSPRITE/issues/3","id":93925947,"number":3,"title":"Feature request -- Add functionality to Linked_list","user":{"login":"dheater","id":1173374,"avatar_url":"https://avatars.githubusercontent.com/u/1173374?v=3","gravatar_id":"","url":"https://api.github.com/users/dheater","html_url":"https://github.com/dheater","followers_url":"https://api.github.com/users/dheater/followers","following_url":"https://api.github.com/users/dheater/following{/other_user}","gists_url":"https://api.github.com/users/dheater/gists{/gist_id}","starred_url":"https://api.github.com/users/dheater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dheater/subscriptions","organizations_url":"https://api.github.com/users/dheater/orgs","repos_url":"https://api.github.com/users/dheater/repos","events_url":"https://api.github.com/users/dheater/events{/privacy}","received_events_url":"https://api.github.com/users/dheater/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"dheater","id":1173374,"avatar_url":"https://avatars.githubusercontent.com/u/1173374?v=3","gravatar_id":"","url":"https://api.github.com/users/dheater","html_url":"https://github.com/dheater","followers_url":"https://api.github.com/users/dheater/followers","following_url":"https://api.github.com/users/dheater/following{/other_user}","gists_url":"https://api.github.com/users/dheater/gists{/gist_id}","starred_url":"https://api.github.com/users/dheater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dheater/subscriptions","organizations_url":"https://api.github.com/users/dheater/orgs","repos_url":"https://api.github.com/users/dheater/repos","events_url":"https://api.github.com/users/dheater/events{/privacy}","received_events_url":"https://api.github.com/users/dheater/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-07-09T01:13:34Z","updated_at":"2015-07-09T02:53:49Z","closed_at":null,"body":"Suggest an `isEmpty()` method on Linked_list:\r\n\r\n    bool Linked_list::isEmpty()\r\n    {\r\n       return m_head == NULL;\r\n    }\r\n\r\nI didn't see one (sorry if it's already there), and it makes the code that uses Linked_list a little cleaner. \r\n\r\nI'd also like to see something like a `pop_front()` and `pop_back()` that retrieve and remove the corresponding element in one shot. It'd give the Linked_list both queue and stack like capability.\r\n"},"comment":{"url":"https://api.github.com/repos/nasa/libSPRITE/issues/comments/119796420","html_url":"https://github.com/nasa/libSPRITE/issues/3#issuecomment-119796420","issue_url":"https://api.github.com/repos/nasa/libSPRITE/issues/3","id":119796420,"user":{"login":"dheater","id":1173374,"avatar_url":"https://avatars.githubusercontent.com/u/1173374?v=3","gravatar_id":"","url":"https://api.github.com/users/dheater","html_url":"https://github.com/dheater","followers_url":"https://api.github.com/users/dheater/followers","following_url":"https://api.github.com/users/dheater/following{/other_user}","gists_url":"https://api.github.com/users/dheater/gists{/gist_id}","starred_url":"https://api.github.com/users/dheater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dheater/subscriptions","organizations_url":"https://api.github.com/users/dheater/orgs","repos_url":"https://api.github.com/users/dheater/repos","events_url":"https://api.github.com/users/dheater/events{/privacy}","received_events_url":"https://api.github.com/users/dheater/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T02:53:49Z","updated_at":"2015-07-09T02:53:49Z","body":"The pop functions are a bit more tricky. Because at the end of the operation, the node is deleted, the data must be copied to be returned to the user.\r\n\r\nI don't want to allocate memory to return within the pop function, because it then becomes the users responsibility to free that memory. Such memory ownership transfers easily become memory leaks.\r\n\r\nI can accept a parameter from the user to the `pop()` function and copy the node data into it. If I pass by reference, and the list is empty, I need a return code to let the user know the returned value is invalid. I can use a pointer parameter and return NULL if the list is empty, but then I can't be sure that the user allocated memory for the pointer or just declared a pointer and passed it in expecting me to return a pointer to the data. Neither option is without fault, Suggestions?"}}