-
Notifications
You must be signed in to change notification settings - Fork 673
Use core::string_view directly instead of alias #3058
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
|
An automated preview of the documentation is available at https://3058.beast.prtest.cppalliance.org/libs/beast/doc/html/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2025-11-30 16:23:30 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3058 +/- ##
===========================================
- Coverage 93.22% 93.19% -0.03%
===========================================
Files 176 176
Lines 13703 13703
===========================================
- Hits 12774 12770 -4
- Misses 929 933 +4
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
Thank you. Could you please check the |
|
This is great! |
24c3156 to
8b0bb38
Compare
|
Thank you @ashtum for the review! I've updated the PR to:
|
Replaced all uses of string_view and basic_string_view with core::string_view and core::basic_string_view respectively throughout the codebase. Closes boostorg#3046
8b0bb38 to
629d37d
Compare
|
Thank you for the detailed review! I've addressed all the feedback:
|
|
Fixed all remaining comment alignment issues. |
|
@ssam18 You can use the GitHub Action CI in your own fork to address the compile errors, since it won’t require approval to run each time. |
Use fully qualified boost::core::string_view instead of core::string_view or beast::string_view to ensure correct namespace resolution in nested boost::beast namespace contexts. This fixes compilation errors across all platforms where the compiler was looking for non-existent types like boost::beast::core::string_view. Fixes CI compilation failures in PR boostorg#3058.
This fixes macOS compilation errors where the compiler couldn't resolve the unqualified string_view type in iterator declarations.
…ace and fix comment alignment
…tring_view The test/doc files are not inside the boost namespace, so they need the fully qualified boost::core::string_view instead of core::string_view. Changed back to boost::core::string_view in all affected test/doc files.
…ring_view Example files are standalone programs not inside the boost namespace, so they require the fully qualified boost::core::string_view. Updated all example files except those in example/doc/ which are already inside the boost namespace.
|
Why the core::string_view → boost::core::string_view change is necessary? The issue: C++ namespace lookup rules mean that when you write core::string_view in a file, the compiler searches for core starting from the current namespace and working outward. This works fine in files already inside namespace boost { ... } because the compiler finds boost::core. But in standalone example and test files that aren't wrapped in the boost namespace, the compiler can't find core at all. FIX: Files need to use the fully qualified name boost::core::string_view unless they're already inside the boost namespace. This is why: Example files (like example/http/server/async/http_server_async.cpp) → Need boost::core::string_view (standalone programs) |
Remove boost:: prefix from core::string_view in implementation files (.ipp) where code is already inside the boost namespace. This makes the code cleaner and follows the project's namespace usage conventions. Also reverted unintended change to release notes as requested by maintainer. Signed-off-by: Samaresh Kumar Singh <[email protected]>
|
@ashtum Please let me know if this PR looks good? |
All files under For example: namespace beast = boost::beast; // from <boost/beast.hpp>
namespace http = beast::http; // from <boost/beast/http.hpp>
namespace websocket = beast::websocket; // from <boost/beast/websocket.hpp>
namespace net = boost::asio; // from <boost/asio.hpp>
namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
namespace core = boost::core; // from <boost/core/detail/string_view.hpp>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>Please review each changed line manually and use your judgment to fix any formatting, clarity, or semantic issues. |
Replace boost::core::string_view with core::string_view throughout example and test/doc directories. Add namespace alias declarations 'namespace core = boost::core;' following project style guidelines.
| namespace websocket = beast::websocket; // from <boost/beast/websocket.hpp> | ||
| namespace net = boost::asio; // from <boost/asio.hpp> | ||
| namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp> | ||
| namespace core = boost::core; // from <boost/core/detail/string_view.hpp> |
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.
Comment should align with upper lines (There are still a few cases of misalignment please fix all of them).
| namespace http = beast::http; // from <boost/beast/http.hpp> | ||
| namespace net = boost::asio; // from <boost/asio.hpp> | ||
| using stream_protocol = net::local::stream_protocol; // from <boost/asio/local/stream_protocol.hpp> | ||
| namespace core = boost::core; // from <core/string_view.hpp> |
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.
namespace core = boost::core; should go after namespace net = boost::asio; not after the using expression.
| namespace beast { | ||
| namespace http { | ||
|
|
||
| namespace core = boost::core; // <core/string_view.hpp> |
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.
What is this <core/string_view.hpp> ? (There are more of them)
| std::uint64_t remain, // The number of bytes remaining in the chunk, | ||
| // including what is being passed here. | ||
| // or zero for the last chunk | ||
| core::string_view body, // The next piece of the chunk body |
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.
Comment alignment.
This PR addresses issue #3046 by replacing all uses of the
string_viewalias withcore::string_viewthroughout the codebase for improved clarity in both documentation and source code.Changes
string_viewwithcore::string_viewin all header files (.hpp)string_viewwithcore::string_viewin all inline implementation files (.ipp)core::string_viewbasic_string_viewwithcore::basic_string_viewwhere applicablestring_type.hppfor backward compatibilityBenefits
boost::core::string_viewFiles Modified
Closes #3046