What is "Narrowing"

Or what is "Narrowing Conversion"?
You've got a number being stored in a whole lot of bytes, and then you're turning it into a number stored in a lot fewer bytes. The risk is losing precision, or just getting a completely different number altogether.
Well then how come this:

bool b = 7;

is ok.


bool b {7};

requires a narrowing conversion?
because narrowing conversions are permitted in copy-initialization and forbidden in list-initialization
Registered users can post here. Sign in or register to post.