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

Addable<T> should evaluate to bool, so you can actually use it with a plain if.

But a plain if requires both true and false branches to type check and if your T is not actually addable and you use operator+ in the true branch you will get a compilation error.



Aah got it. Thank you!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: