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

<=> on primitives probably won't be any faster than the binary comparison operators because of compiler optimizations.

However, something like std::less can be accidentally exponential on deeply-nested objects like trees: https://news.ycombinator.com/item?id=26344987. This is because two separate comparison operations may be performed at each level (< in both directions for std::less), each of which may recurse on the corresponding nodes. <=> does not suffer from this problem as it means that only one (rich) comparison is performed for each node.




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

Search: