{"action":"created","issue":{"url":"https://api.github.com/repos/edouarda/brigand/issues/127","repository_url":"https://api.github.com/repos/edouarda/brigand","labels_url":"https://api.github.com/repos/edouarda/brigand/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/edouarda/brigand/issues/127/comments","events_url":"https://api.github.com/repos/edouarda/brigand/issues/127/events","html_url":"https://github.com/edouarda/brigand/issues/127","id":136162154,"number":127,"title":"remove_if has max instantiation depth issues ","user":{"login":"porkybrain","id":10760132,"avatar_url":"https://avatars.githubusercontent.com/u/10760132?v=3","gravatar_id":"","url":"https://api.github.com/users/porkybrain","html_url":"https://github.com/porkybrain","followers_url":"https://api.github.com/users/porkybrain/followers","following_url":"https://api.github.com/users/porkybrain/following{/other_user}","gists_url":"https://api.github.com/users/porkybrain/gists{/gist_id}","starred_url":"https://api.github.com/users/porkybrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porkybrain/subscriptions","organizations_url":"https://api.github.com/users/porkybrain/orgs","repos_url":"https://api.github.com/users/porkybrain/repos","events_url":"https://api.github.com/users/porkybrain/events{/privacy}","received_events_url":"https://api.github.com/users/porkybrain/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-02-24T19:27:38Z","updated_at":"2016-02-25T15:12:49Z","closed_at":null,"body":"Since its recursive it will only go to about 250 elemts on clang and 500 elements on MSVC. Its not so trivial to fast track though since both removing most elements and removing only a few elements are possible scenarios.\r\n\r\nI think the strategy of dealing with the last test results and testing the next type (and sometimes fast track) all at once strategy I have been using is not so suited this time. Since we are going to do at least N instantiations fo the predicate we could just do them once with pack expantion and pass the result together with the inputs to the recursive function, that would make it easier to write the recursion and then just do pattern matching on 8 falses or 8 trues as a fast track. The problem is that the instantiation depth would then be very dependent on the data and thus far less deterministic. \r\n\r\nWhat do you guys think?\r\n\r\nOn a side note I wonder if exploiting the fact that `x{(Ts*)0...}` could be either a call to a constructor with a variadic pack if types are different or a call to a constructor with an initializer list when all type are the same could add some speed to `all` or `none`.\r\n\r\n```C++\r\n\r\nstruct AllSameType {\r\n\tbool value;\r\n\tconstexpr AllSameType(...) :value{ false } {}\r\n\ttemplate<typename T>\r\n\tconstexpr AllSameType(std::initializer_list<T>) : value{ true } {}\r\n};\r\n\r\ntemplate<typename...Ts>\r\nconstexpr bool all_same() {\r\n\treturn AllSameType{ ((Ts*)0)... }.value;\r\n}\r\n\r\nstatic_assert(all_same<int, int, int>(), \"\");\r\nstatic_assert(!all_same<bool, int, float>(), \"\");\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/edouarda/brigand/issues/comments/188829302","html_url":"https://github.com/edouarda/brigand/issues/127#issuecomment-188829302","issue_url":"https://api.github.com/repos/edouarda/brigand/issues/127","id":188829302,"user":{"login":"edouarda","id":331889,"avatar_url":"https://avatars.githubusercontent.com/u/331889?v=3","gravatar_id":"","url":"https://api.github.com/users/edouarda","html_url":"https://github.com/edouarda","followers_url":"https://api.github.com/users/edouarda/followers","following_url":"https://api.github.com/users/edouarda/following{/other_user}","gists_url":"https://api.github.com/users/edouarda/gists{/gist_id}","starred_url":"https://api.github.com/users/edouarda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edouarda/subscriptions","organizations_url":"https://api.github.com/users/edouarda/orgs","repos_url":"https://api.github.com/users/edouarda/repos","events_url":"https://api.github.com/users/edouarda/events{/privacy}","received_events_url":"https://api.github.com/users/edouarda/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T15:12:49Z","updated_at":"2016-02-25T15:12:49Z","body":"Worth a try maybe?"}}