Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>I haven't investigated it but variadic template template arguments might help there, though.

They do:

    template <template <typename...> class Container, typename T>
    Container <T> fin (T n) {
        Container <T> set;
        for (T i = 0; i < n; ++i)
            set.push_back (i);
        return set;
    }
    
    int main () {
        for (int i : fin <std::vector> (10))
            std::cout << i << std::endl;
    }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: