|
Boost : |
From: Kevin Sopp (baraclese_at_[hidden])
Date: 2007-10-31 16:36:34
Hi Chris,
> Its just as easy to do this outside the message_digest class using
> input(void*,size_t)
I'm not a fan of this constructor for this reason and
1) because I like minimal class interfaces - the same functionality
can be implemented as free function.
2) because it doesn't handle io errors in a useful way, i.e. it is not
discernible if the digest is wrong because of an io error (not enough
bytes could be read) or because the file is different from what was
expected.
Also it's generally not a good idea to do expensive operations in a
ctor. Reading a file qualifies as expensive.
> This may not be the best impl. I use basic_ios because its the first
> class in the ios_base hierarchy that provides rdbuf().
I would have expected an istream& argument to make clear that an input
stream is required.
Kevin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk