|
Boost : |
Subject: [boost] Data / String Ref library
From: Olaf van der Spek (olafvdspek_at_[hidden])
Date: 2011-03-29 11:31:48
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?
-- Olaf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk