26 Jan
2015
26 Jan
'15
9 p.m.
On Mon, Jan 26, 2015 at 10:11 AM, Peter Dimov
However, this allows me to sneak in another comment. Currently, if I try to put 0x123456 into a 16 bit buffer, it silently cuts it to 0x3456 without missing a beat. This is sometimes, but very rarely, what we want. Typically, what one wants in this case is an exception, because this usually happens when writing a file, and if one tries to write 0x123456 and only 0x3456 comes out, it's likely that the result will be corrupted and unreadable.
Good idea! Perhaps an error checking policy could be added as a template parameter, with two supplied - one a nop, the other throwing an exception on overflow. I'll document that somewhere as a high priority for the future. --Beman