Boost logo

Boost :

From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2022-08-24 08:12:34


wt., 23 sie 2022 o 23:32 Vinnie Falco <vinnie.falco_at_[hidden]> napisał(a):

> On Tue, Aug 23, 2022 at 2:30 PM Vinnie Falco <vinnie.falco_at_[hidden]>
> wrote:
> > > If you used result<>, you would lose the ability to chain the setters.
> >
> > Yeah... well, I think I'm OK with that.
>
> If you chain the setters then how can you look at the result to see if
> it failed? Anyway.. I thought of a solution:
>
> result< url_base& > url_base::set_port( string_view s );
>
> now you can write
>
> url().set_port( "8080" )->set_encoded_host( "www.example.com"
> )->set_path( "/" )
>

Actually, I thought about something like:

error_code ec;
url.set_port(s1, ec).set_encoded_host(s2, ec).set_path(s3, ec);

or:

error_code ec1, ec2, ec3;
url.set_port(s1, ec1).set_encoded_host(s2, ec2).set_path(s3, ec3);

And then some operations would not set their part upon invalid input and
record this in the error code.
But the library seems to be moving away from error codes.

Regards,
&rzej;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk