{"action":"created","issue":{"url":"https://api.github.com/repos/jaredhoberock/tuple/issues/8","labels_url":"https://api.github.com/repos/jaredhoberock/tuple/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/jaredhoberock/tuple/issues/8/comments","events_url":"https://api.github.com/repos/jaredhoberock/tuple/issues/8/events","html_url":"https://github.com/jaredhoberock/tuple/issues/8","id":55698541,"number":8,"title":"inefficient storage scheme","user":{"login":"andrewcorrigan","id":1383453,"avatar_url":"https://avatars.githubusercontent.com/u/1383453?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewcorrigan","html_url":"https://github.com/andrewcorrigan","followers_url":"https://api.github.com/users/andrewcorrigan/followers","following_url":"https://api.github.com/users/andrewcorrigan/following{/other_user}","gists_url":"https://api.github.com/users/andrewcorrigan/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewcorrigan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewcorrigan/subscriptions","organizations_url":"https://api.github.com/users/andrewcorrigan/orgs","repos_url":"https://api.github.com/users/andrewcorrigan/repos","events_url":"https://api.github.com/users/andrewcorrigan/events{/privacy}","received_events_url":"https://api.github.com/users/andrewcorrigan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-28T00:49:57Z","updated_at":"2015-01-28T01:22:13Z","closed_at":null,"body":"I understand that the precise memory layout of tuple is an implementation detail, however I believe that a template specialization is needed to avoid storing tail as `tuple<>` in `tuple<T>`.  I compared your `tuple`'s size (in namespace `thr`) with that of `std::tuple` (from libc++).  \r\n\r\n\r\n```\r\nsizeof(thr::tuple<>): 1\r\nsizeof(std::tuple<>): 1\r\nsizeof(thr::tuple<int>): 8\r\nsizeof(std::tuple<int>): 4\r\nsizeof(thr::tuple<int,int>): 12\r\nsizeof(std::tuple<int,int>): 8\r\nsizeof(thr::tuple<int,int,int>): 16\r\nsizeof(std::tuple<int,int,int>): 12\r\nsizeof(thr::tuple<int,int,int,int>): 20\r\nsizeof(std::tuple<int,int,int,int>): 16\r\n```\r\n\r\nIt gets worse with nesting -- in this case twice the storage as compared to libc++ is consumed!\r\n```\r\nsizeof(thr::tuple<int,thr::tuple<int>>): 16\r\nsizeof(std::tuple<int,std::tuple<int>>): 8\r\nsizeof(thr::tuple<int,thr::tuple<int,thr::tuple<int>>>): 24\r\nsizeof(std::tuple<int,std::tuple<int,std::tuple<int>>>): 12\r\nsizeof(thr::tuple<int,thr::tuple<int,thr::tuple<int,thr::tuple<int>>>>): 32\r\nsizeof(std::tuple<int,std::tuple<int,std::tuple<int,std::tuple<int>>>>): 16\r\n```\r\n\r\nI think the solution is to just specialization for `thrust::tuple<T>`, which lacks a `tuple<> tail_`."},"comment":{"url":"https://api.github.com/repos/jaredhoberock/tuple/issues/comments/71764311","html_url":"https://github.com/jaredhoberock/tuple/issues/8#issuecomment-71764311","issue_url":"https://api.github.com/repos/jaredhoberock/tuple/issues/8","id":71764311,"user":{"login":"jaredhoberock","id":1253007,"avatar_url":"https://avatars.githubusercontent.com/u/1253007?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredhoberock","html_url":"https://github.com/jaredhoberock","followers_url":"https://api.github.com/users/jaredhoberock/followers","following_url":"https://api.github.com/users/jaredhoberock/following{/other_user}","gists_url":"https://api.github.com/users/jaredhoberock/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredhoberock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredhoberock/subscriptions","organizations_url":"https://api.github.com/users/jaredhoberock/orgs","repos_url":"https://api.github.com/users/jaredhoberock/repos","events_url":"https://api.github.com/users/jaredhoberock/events{/privacy}","received_events_url":"https://api.github.com/users/jaredhoberock/received_events","type":"User","site_admin":false},"created_at":"2015-01-28T01:22:13Z","updated_at":"2015-01-28T01:22:13Z","body":"Alternative may be to derive from the tail so the compiler can use the zero size base class optimization."}}