-
Notifications
You must be signed in to change notification settings - Fork 13
Simplify io_result<> constructors to eliminate include-order dependency #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughConsolidates multiple Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
|
An automated preview of the documentation is available at https://115.capy.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-01-29 15:03:10 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@include/boost/capy/io_result.hpp`:
- Around line 64-74: Update the io_result(E const& e) noexcept constructor
docstring to document the template parameter E, the constructor parameter e, the
template constraint (requires E to be convertible to std::error_code /
std::is_convertible<E, std::error_code>::value), any preconditions (e must
represent a valid error_code) and the noexcept guarantee (constructor is
noexcept and will not throw); mention that the constructor accepts
std::error_code, boost::system::error_code, error-code enums or any type
implicitly convertible to std::error_code and that it initializes the member ec.
Replace three separate constructors with a single template constructor that accepts any type convertible to std::error_code. The old approach used #ifdef BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED to conditionally compile the boost::system::error_code constructor. This created a fragile include-order dependency: if io_result.hpp was included before boost/system/error_code.hpp, the direct constructor wasn't available, forcing MSVC to apply two implicit conversions which triggers warning C4927. The new single template constructor handles all cases uniformly by relying on std::error_code's existing constructors and conversion operators. This eliminates the C4927 warning and removes the need to carefully order includes in headers that use io_result with Boost error codes.
349688c to
60efdc5
Compare
Replace three separate constructors with a single template constructor that accepts any type convertible to std::error_code. The old approach used #ifdef BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED to conditionally compile the boost::system::error_code constructor. This created a fragile include-order dependency: if io_result.hpp was included before boost/system/error_code.hpp, the direct constructor wasn't available, forcing MSVC to apply two implicit conversions which triggers warning C4927.
The new single template constructor handles all cases uniformly by relying on std::error_code's existing constructors and conversion operators. This eliminates the C4927 warning and removes the need to carefully order includes in headers that use io_result with Boost error codes.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.