[squid-dev] [PATCH] Extend SBufContainerJoin to have prefix and suffix arguments

Kinkie gkinkie at gmail.com
Fri Nov 11 08:30:22 UTC 2016


On Fri, Nov 11, 2016 at 5:02 AM, Amos Jeffries <squid3 at treenet.co.nz> wrote:
> On 11/11/2016 9:28 a.m., Kinkie wrote:
>>
>> v4 attached.
>>
>
> Does it have to take begin() and end() iterators explicitly?
>  can we not have it take the container itself and use a for(auto &i :
> container) loop ?

No it doesn't but it's sometimes convenient.
My use case is the regex-compressing code. It can be reduced to (pseudocode)

join(regex-so-far, wordsList., separator=")|(", prefix="(", suffix=")")

granted, it can be done with explicit append calls but then you can't
inline it (e.g in streams).

The code used to take the whole container, but there's a use case for
iterating over a slice only.

-- 
    Francesco


More information about the squid-dev mailing list