deal all:
i saw this staticconst size_t npos = -1; in the string reference,yet because size_t is an unsigned integral type,i do know if it is safe to do so,or does it make any sense ?
is not ~0=0xffffffff ? i do not see there is any difference between the two ?
That's more or less what I was saying, but not quite.
I was saying that (unsigned)-1 is not the best way to set all bits, because on some architectures, (unsigned)-1 translates to ~1. ~0 sets all bits regardless of the architecture, but it's not the same as 0xFFFFFFFF. For example, if sizeof(int)==8, the upper 32 bits are still cleared with 0xFFFFFFFF (0x00000000FFFFFFFF).