Boost logo

Boost :

Subject: Re: [boost] [review] **NEXT WEEK** Review of Outcome (starts Fri-19-May)
From: charleyb123 . (charleyb123_at_[hidden])
Date: 2017-05-15 00:39:28

> spaketh Vinnie:

Head check: Is the following function signature "correct" or should it
> use system_error?
> template<
> typename SyncReadStream,
> typename MutableBufferSequence>
> std::size_t
> read(
> SyncReadStream& s,
> MutableBufferSequence const& buffers,
> boost::system::error_code& ec);

That signature is "correct":

(a) It happens to use 'boost::system::error_code', which is a complete
C++03 implementation compatible with C++11's <system_error>.

(b) C++11 libraries can consider moving to 'std::error_code'. Otherwise,
an "adapter" can be implemented to enable 'boost::system::error_code' to
inter-operate with C++11's 'std::error_code'. A nice blog article by Bjorn
Reese on that topic can be found at:

(c) The C++11 'class std::system_error : public std::runtime_error { ...};'
is a convenience utility to 'throw' a 'std::error_code' value as
"payload". Since your 'read()' function signature (by convention) appears
to be non-throwing, you wouldn't need 'std::system_error' here (as the
'std::error_code' can be populated directly in the function body).

Hope that helps ...?


Boost list run by bdawes at, gregod at, cpdaniel at, john at