wt., 23 sie 2022 o 23:32 Vinnie Falco
On Tue, Aug 23, 2022 at 2:30 PM Vinnie Falco
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;