-
Notifications
You must be signed in to change notification settings - Fork 645
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
Errors with string_view
since update to 1.81.0
#2594
Comments
The idea was to unify this, because otherwise it gets weird. With the header set, boost::core::string_view can interact with std::string_view, but it doesn't work the other way. The problem is not only that beast is a C++11 library and I am surprised @vinniefalco what do you think? |
I see your point about the standard libraries becoming stale from the point of view of the library author. For the specific case of As a library user targeting C++20, I prefer using the standard library where possible and see the boost libraries as one source of libraries to provide me the features I need (here mostly networking); similar to any other library on github. I that sense I would prefer if boost's effort for fallback implementations for old C++ standards and improved versions of existing standard library code were in a separate project. I understand this is personal opinion and doesn't align with the general direction of the boost project. Btw, |
I prefer not to have the API/ABI of the library change based on a macro. |
Feel free to close the issue, unless you think it's worth keeping it open for one of the following points:
About 2) I saw #110, saying:
and following the link there, I saw some comment in an older version of the source file
Previously, I was using |
With this change and the deprecation of to_string() - snapcast fails to compile. is the fix to cast https://www.learncpp.com/cpp-tutorial/introduction-to-stdstring_view/ |
The documentation needs to be updated, sorry for this confusion! |
Thanks Vinnie and Klemens for all your work. Unfortunately I'm a bit too far away from the code to be able to send a PR for the doc. |
So long story short, boost 1.81 has fairly large breaking API changes, as they migrated to use an internal string_view shim rather than std::string_view, across the entire beast codebase. Therefore, we remove any attempts to convert to std::string_view from boost::core::string_view, as it implicitly handles conversions to std::string where needed (like std::string_view). Long story. boostorg/beast#2451 introduced a change in their string_view type defs for beast, which ultimately removed the to_string() method inherited from boost::string_view (which is different to boost::core), effectively changing the type of most of the returned values in rgw_asio_client.cc's header manipulation logic. However, this new shim string_view implicitly converts to std::string, which is needed by RGWEnv::set, hence our removal of the various to_string()s scattered across the file. Notably, RGWEnv::set is remarkably strict in its accepted values, so I trust that if this compiles we have introduced a subtle use after free vis-a-vis all these string_views flying around. References: boostorg/beast#2451 References: https://github.com/ceph/ceph/blob/v17.2.5/src/rgw/rgw_asio_client.cc References: boostorg/beast#2594 (comment) References: https://github.com/ceph/ceph/blob/v17.2.5/src/rgw/rgw_env.cc#L22
When updating to boost 1.81.0, I faced some compile errors in my code along with deprecation warnings
This links to #2451.
Looking into that, it looks like beast now uses always
boost::core::string_view
which seems to be a separate string_view implementation (with some implicit converstions tostd::string_view
). As it's indetails
, it's not documented.Loosing the ability to directly use
std::string_view
looks like a step back to me. Some things that used to work don't work anymore, like implicitly assigning astring_view
to astd::filesystem::path
. Obviously this is nothing that can't be worked around, but this illustrates why having multiplestring_view
implementations isn't necessarily a good idea.The deprecation warning seems also a bit misleading.
BOOST_NO_CXX17_HDR_STRING_VIEW
seems to do the opposite toBOOST_BEAST_USE_STD_STRING_VIEW
(eg. completely switch off conversions tostd::string_view
).Please correct me if I got something wrong.
Would you consider bringing back the option to use
std::string_view
?The text was updated successfully, but these errors were encountered: