
On Tue, Mar 29, 2011 at 17:31, Olaf van der Spek <olafvdspek@gmail.com>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?
-- Olaf _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
You already can use boost::iterator_range<const char*>. -- Yakov