Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-08-18 15:33:05


"Jeremy Maitin-Shepard" <jbms_at_[hidden]> wrote in message
news:87iry3c9cn.fsf_at_jbms.ath.cx...
> "Thorsten Ottosen" <nesotto_at_[hidden]> writes:
>
> > "Thorsten Ottosen" <nesotto_at_[hidden]> wrote in message
> > news:de2lb2$d6u$1_at_sea.gmane.org...
> >>
> >> "Christopher Kohlhoff" <chris_at_[hidden]> wrote in message
>
> >> 5. can't socket.recv() use something more highlevel than void* and
size_t
> >> arguments?
> >> Why not std::vector<char> ? (The same applies to all the interface
> >> functions)
>
> std::vector<char> (even with additional offset and length parameters)
> introduces significant overhead for users that do not otherwise have any
> reason to use std::vector. I do not think the additional safety
> provided is worth the cost of this overhead.

doesn't the overhead depend on the amount of data sent?

> > Furthermore, if you do want array arguments, then you might just
> > say
>
> > template< class T, std:size_t N >
> > void receive( T (&array)[N] )
> > { /* call void ptr version here */ }
>
> > or perhaps just
>
> > template< std::size_t N >
> > void receive( char (&array)[N] ) { ... }
>
> Requiring that the size be known at compile-time, and that an actual
> static-sized array be used in order to call the receive function, is
> definitely not a good idea.

Then why do all the examples work on statically sized arrays?

If we're not working on statically sized arrays, then why not use vector?

I'm not convinced about any overhead noticable associated wirh vector.

Besides, both versions could be provided.

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk