|
Boost : |
Subject: Re: [boost] Data / String Ref library
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2011-03-29 13:07:32
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?
Cheers,
Rutger
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk