Boost logo

Boost :

Subject: Re: [boost] Data / String Ref library
From: Olaf van der Spek (olafvdspek_at_[hidden])
Date: 2011-04-02 12:45:58


On Tue, Mar 29, 2011 at 7:07 PM, Rutger ter Borg <rutger_at_[hidden]> wrote:
> On 2011-03-29 17:31, Olaf van der Spek wrote:
>>
>> Hi,
>>
>> A lot of functions take a const void*, size_t pair as two parameters.
>> This is then cast to a const unsigned char* for further processing.
>> Two parameters means you can't easily pass the result of an expression
>> or function call. One parameter would be handier.
>>
>> const std::string&  is also used frequently. However, this forces the
>> caller to use (or construct) std::string, which is undesirable and
>> unnecessary.
>>
>> A solution seems simple: data_ref and string_ref, which represent a
>> pointer pair (void/unsigned char and char respectively).
>> string_ref can replace const std::string&, data_ref can replace const
>> void*, size_t.
>>
>> I think this would be a nice addition to Boost.
>> Is there any interest in a library that solves this problem?
>>
>
> Asio's buffer-handling concepts and classes might be what you are looking
> for?

Yes, those appear to be close to the required functionality. I'll have a look.

-- 
Olaf

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