This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: deb/ddeb support for debuginfod


* Florian Weimer:

> * Frank Ch. Eigler:
>
>> +inline bool
>> +string_endswith(const string& haystack, const string& needle)
>> +{
>> +  return (haystack.size() >= needle.size() &&
>> +	  haystack.substr(haystack.size()-needle.size()) == needle);
>> +}
>
> I think you should use std::equal because substr allocations.  So
> something loke htos:
>
>   return (haystack.size() >= needle.size()
>           && std::equal(haystack.end() - needle.size(), haystack.end(),
>                         needle.begin(), needle.end()));

Eh, you have to drop the needle.end() for C++98 compatibility.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]