Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #43589
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: A case insensitive substring search? |
| Date | 2016-06-29 10:56 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <871t3ggvy2.fsf@bsb.me.uk> (permalink) |
| References | <C6mdnaL0a8umRu_KnZ2dnUU7-cHNnZ2d@giganews.com> <877fd9gcav.fsf@bsb.me.uk> <8tadndSUROtJxu7KnZ2dnUU7-X3NnZ2d@giganews.com> |
James Moe <jimoeDESPAM@sohnen-moe.com> writes:
> On 06/28/2016 03:48 PM, Ben Bacarisse wrote:
>> You need search, not search_n.
>>
> Tried that. No luck.
> bool strstricmp (string & s1, string & sub2)
> {
> string::iterator pos;
>
> pos = search(s1.begin, s1.end(),
> sub2.begin(), sub2.end(),
> icompare);
> return (pos != s1.end());
> }
> Complains that there is no match for the predicate.
Seems odd. I'd expect more problems to come from the missing () after
s1.begin. When I fix that, it works here.
You should consider making s1 and sub2 references to const.
>> And if you are using modern C++ you can [...]
>>
> Alas, no. g++ 4.7.3.
The [...] went on to suggest using an anonymous function. I thought
these were introduced in gcc 4.5.
--
Ben.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A case insensitive substring search? James Moe <jimoeDESPAM@sohnen-moe.com> - 2016-06-28 13:16 -0700
Re: A case insensitive substring search? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-28 23:48 +0100
Re: A case insensitive substring search? James Moe <jimoeDESPAM@sohnen-moe.com> - 2016-06-28 22:25 -0700
Re: A case insensitive substring search? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-29 10:56 +0100
Re: A case insensitive substring search? Öö Tiib <ootiib@hot.ee> - 2016-06-29 04:19 -0700
Re: A case insensitive substring search? James Moe <jimoeDESPAM@sohnen-moe.com> - 2016-06-29 10:48 -0700
Re: A case insensitive substring search? Nobody <nobody@nowhere.invalid> - 2016-06-29 00:39 +0100
Re: A case insensitive substring search? Öö Tiib <ootiib@hot.ee> - 2016-06-29 06:22 -0700
Re: A case insensitive substring search? Ralf Goertz <me@myprovider.invalid> - 2016-06-29 17:16 +0200
Re: A case insensitive substring search? Öö Tiib <ootiib@hot.ee> - 2016-07-01 01:46 -0700
Re: A case insensitive substring search? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-06-29 21:32 +0200
Re: A case insensitive substring search? Nobody <nobody@nowhere.invalid> - 2016-07-01 07:53 +0100
csiph-web