{"action":"created","issue":{"url":"https://api.github.com/repos/mayah/tinytoml/issues/7","repository_url":"https://api.github.com/repos/mayah/tinytoml","labels_url":"https://api.github.com/repos/mayah/tinytoml/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/mayah/tinytoml/issues/7/comments","events_url":"https://api.github.com/repos/mayah/tinytoml/issues/7/events","html_url":"https://github.com/mayah/tinytoml/issues/7","id":132256332,"number":7,"title":"Add convenience function for array","user":{"login":"zmb3","id":7527103,"avatar_url":"https://avatars.githubusercontent.com/u/7527103?v=3","gravatar_id":"","url":"https://api.github.com/users/zmb3","html_url":"https://github.com/zmb3","followers_url":"https://api.github.com/users/zmb3/followers","following_url":"https://api.github.com/users/zmb3/following{/other_user}","gists_url":"https://api.github.com/users/zmb3/gists{/gist_id}","starred_url":"https://api.github.com/users/zmb3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmb3/subscriptions","organizations_url":"https://api.github.com/users/zmb3/orgs","repos_url":"https://api.github.com/users/zmb3/repos","events_url":"https://api.github.com/users/zmb3/events{/privacy}","received_events_url":"https://api.github.com/users/zmb3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-08T21:04:06Z","updated_at":"2016-02-09T02:31:23Z","closed_at":null,"body":"It would be nice if there were an easier way to get the elements from a `toml::Array`.  Since an Array is just a `std::vector<toml::Value>`, you have to manually convert each `Value` element to the underlying type.\r\n\r\nI would like to be able to do something like this:\r\n\r\n```cpp\r\ntoml::Value v = ...;\r\ntoml::Array arr = v.get<toml::Array>(\"foo\");\r\nstd::vector<int> int_vec = toml::array_convert<int>(arr);\r\n\r\n// or maybe add an additional template argument:\r\nstd::vector<int> arr = v.get<toml::Array, int>(\"foo\");\r\n```\r\nWould something like this be a good candidate for the library?  \r\n\r\nPerhaps another option would be to make `Array` a class and not an alias for vector, and then you could add `is<T>()` and `as<T>()` methods similar to `toml::Value`.\r\n"},"comment":{"url":"https://api.github.com/repos/mayah/tinytoml/issues/comments/181674492","html_url":"https://github.com/mayah/tinytoml/issues/7#issuecomment-181674492","issue_url":"https://api.github.com/repos/mayah/tinytoml/issues/7","id":181674492,"user":{"login":"mayah","id":53658,"avatar_url":"https://avatars.githubusercontent.com/u/53658?v=3","gravatar_id":"","url":"https://api.github.com/users/mayah","html_url":"https://github.com/mayah","followers_url":"https://api.github.com/users/mayah/followers","following_url":"https://api.github.com/users/mayah/following{/other_user}","gists_url":"https://api.github.com/users/mayah/gists{/gist_id}","starred_url":"https://api.github.com/users/mayah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mayah/subscriptions","organizations_url":"https://api.github.com/users/mayah/orgs","repos_url":"https://api.github.com/users/mayah/repos","events_url":"https://api.github.com/users/mayah/events{/privacy}","received_events_url":"https://api.github.com/users/mayah/received_events","type":"User","site_admin":false},"created_at":"2016-02-09T02:31:23Z","updated_at":"2016-02-09T02:31:23Z","body":"Sounds reasonable. However, I don't like to change `toml::Array` type.\r\n\r\nI would like to avoid adding the second type to `get()` template, because the second type makes sense only when the first type is toml::Array. Probably, we would like to have something like `v.get<std::vector<int>>(\"foo\")`? Isn't it more sophisticated?\r\n\r\n\r\n"}}