Safely Compare Integers of Different Types
Learn to use safely compare integers of different types in C++20.
We'll cover the following...
Comparing different types of integers may not always produce the expected results.
For example:
int x{ -3 };unsigned y{ 7 };if(x < y) puts("true");else puts("false");
We may expect this code to print true
, and that's understandable, as