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

can i say T : SomeConstraint ?


in C++ ? sure

    template<SomeConstraint T>
    void F(T p) { ... }
or just

    void F(SomeConstraint auto p) { ... }

like this for instance: https://gcc.godbolt.org/z/hPM38T


cool, can i even add two constraints? or is it limited to one. Oh i see you have include concepts, is that new to c++20 then?




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

Search: