Hacker News new | past | comments | ask | show | jobs | submit login

> Well, nothing I suppose, except BaseClass cannot then be a template

    template <class T>
    void myFunc(List<T*>){
        static_assert(stuff about T that you want to guarantee at compile time); 
    }
See here: https://en.cppreference.com/w/cpp/header/type_traits

For a list of common functions used for compile-time type checking.




Thank you for this conversation. You've given me some homework to read up on, and I appreciate it a lot!




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

Search: