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

Why would you constrain a generic with ops::Add, if you didn't want to specifically allow for generic implementations of +? If you just want to be generic over built-in integers, it would be as easy as a "trait Integer: Add + Sub + Mul + TryFrom<i32> + ... {}" that's implemented by the standard integer types and sealed off from outside implementations.


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

Search: