Boost logo

Boost :

From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2005-08-19 04:38:29


----Original Message----
From: Thorsten Ottosen [mailto:nesotto_at_[hidden]]
Sent: 19 August 2005 00:10
To: boost_at_[hidden]
Subject: Re: [boost] asio networking proposal

>
> If the only performance sensible iterator types are T*,
> I would't mind simply
>
> template< unsigned N >
> void receive( char (&)[N] );
>
> template< unsigned N >
> void receive( char (&)[N], unsigned size );
>
> void recieve( vector<char>& );
>
> void recieve( vector<char>&, unsigned size );
>
> or something.
>
> I have a hard time imagining any overhead imposed by
> vector<char> compared to a heap-allocated char*.
>

I'm commenting from the sidelines here, and I'm in the camp that
instinctively recoils from a (void*,size_t) interface.

However, if we can persuade Christopher to add a slightly higher level
interface, can I put in a plea for it to be in terms of "unsigned char",
rather than plain char? I don't know about others, but I have a convention
that "char" means "textual data", and "unsigned char" is reserved for "raw
memory".

(Unsigned char also makes it easier to grab bit-fields by shifting - the
behaviour is more completely defined).

Also:
> void receive( char (&)[N], unsigned size );
> void recieve( vector<char>& );
          ^^
I was going to post that there is an argument in favour of recv as opposed
to receive, and Thorsten has just provided a nice example of it!

-- 
Martin Bonner
Martin.Bonner_at_[hidden]
Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ,
ENGLAND Tel: +44 (0)1223 441434

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