Subject: Re: [boost] Boost.Algorithm design question
From: Joe Mucchiello (jmucchiello_at_[hidden])
Date: 2011-10-10 22:29:14
On 10 Oct 2011 10:32:53 +0200, Thorsten Ottosen <thorsten.ottosen_at_[hidden]> wrote:
> Den 07-10-2011 20:45, Joe Mucchiello skrev:
>> On Fri, 07 Oct 2011 10:30:26 +0200, Thorsten
> Ottosen<thorsten.ottosen_at_[hidden]> wrote:
>>> Den 06-10-2011 18:27, Phil Endecott skrev:
>>>> Thorsten Ottosen wrote:
>>>>> Even better, don't use vector<const char*>. What o
> you need that for?
>>>> Here's a real motivating example where I want to use
>>>> char*>. I have a large file containing null-terminated strings
> which I
>>>> memory map. After opening the file, I construct some sort of index
>>>> those strings in a sorted vector. Then I search for things using
>>>> std::equal_range, std::lower_bound, or similar.
>>> That's a good example, I grant you.
>> I actually have a helper class for this called cstrptr which is a typedef
> for the template class
>> basic_cstrptr<char>. It is a "dumb" wrapper around const
> char * that provides some std::string
> Also, something like iterator_range<const char*> might be somewhat more
> handy to store in the vector.
Perhaps in the generic case, but as I said, my class is for magic text found in
programs and you practically never need to run generic algorithm against lists
of magic text.
The value in my class is that it is basically the same size as a pointer to char
and has a near nop constructor. But my class might be too specific for boost
based on the lack of any reaction to the concept. It is just a little fluff class.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk