|
Boost : |
Subject: Re: [boost] Reforming Boost.System and <system_error> round 2
From: Peter Dimov (lists_at_[hidden])
Date: 2018-01-16 17:09:51
Andrey Semashev wrote:
> Calling (virtual) `error_category::failure` early is a waste if the user
> doesn't want to call that function himself. For instance, he may want to
> test specific error codes instead.
It can still be worth it because it's more likely to occur in a context
where the compiler can see what category is being used. When you have
error_code ec( r, system_category() );
and system_category() is constexpr, the compiler knows with certainty what
the call category().failed( r ) will do, so it will replace it with r != 0.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk