From: Jeremy Maitin-Shepard (jbms_at_[hidden])
Date: 2005-08-19 14:19:22
"Thorsten Ottosen" <nesotto_at_[hidden]> writes:
> I'm proposing a lot. In one mail I wrote vector<T>.
> I don't know what's required, if you can only send chars or not.
> So if you need to send arbitrary data, then just allow both
> T (&)[N] and vector<T>. (so no copy needed)
Aside from all the other reasons for not requiring the use of vector,
which I believe are sufficient, there are also the following problems:
If reading a type other than char is allowed, it is difficult to have a
useful interface for the simple "recv" and "recv_at_leaast_n" versions,
because the total number of bytes read might not be divisible by
sizeof(T). Thus, the library would still need to tell the user the
number of bytes read, rather than the number of T read, and the `offset'
parameter would also need to be specified in bytes, rather than in
number of T, so that these partial reads could be completed; these
limitations would surely negate any benefit of allowing reading T rather
than just char. (Trying to ensure that the number of bytes read is
divisible by sizeof(T) is not really feasible.)
Another issue is that in the case that T is a large structure, the user
may only want to read a single one, in which case it would be
undesirable to have to use either an array or a vector.
-- Jeremy Maitin-Shepard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk