|
Boost : |
From: Rainer Deyke (rdeyke_at_[hidden])
Date: 2021-10-15 17:24:45
On 15.10.21 18:34, Vinnie Falco via Boost wrote:
> On Fri, Oct 15, 2021 at 9:04 AM Rainer Deyke via Boost
> <boost_at_[hidden]> wrote:
>> The following would do the trick:
>>
>> auto u1 = parse_relative_ref<url_view>( "/" ).value();
>> auto u2 = parse_relative_ref<url>( "/" ).value();
>> auto u3 = parse_relative_ref<static_url<1024>>( "/" ).value();
>> auto u4 = parse_relative_ref<pmr_url>( "/" ).value();
>> auto u5 = parse_relative_ref<dynamic_url<
>> std::allocator<char>>>( "/" ).value();
>
> Yeah, kinda. This is not expert friendly but also, does not
> accommodate this use-case:
>
> struct connection {
> url u_;
>
> void process( string_view s )
> {
> u_ = parse_uri( s );
> ...
> }
> };
>
> In the code above, the capacity for u_ is reused for each I/O cycle.
You can always do this:
struct connection {
url u_;
void process( string_view s )
{
u_ = parse_uri<url_view>( s );
...
}
};
-- Rainer Deyke (rainerd_at_[hidden])
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk