-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Make <string_view>
slimmer by default
#4633
Merged
StephanTLavavej
merged 2 commits into
microsoft:main
from
frederick-vs-ja:split-string_view-header
May 30, 2024
Merged
Make <string_view>
slimmer by default
#4633
StephanTLavavej
merged 2 commits into
microsoft:main
from
frederick-vs-ja:split-string_view-header
May 30, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The new header `<__msvc_string_view.hpp>` provides `char_traits` and `basic_string_view` and related utilities. `<string_view>` shouldn't provide other utilities in `<xstring>`. `<ranges>` seemingly still need to include `<xmemory>` in C++23 due to `elements_of` whose default template argument depends on `allocator`. Escape hatch `_LEGACY_CODE_ASSUMES_STRING_VIEW_INCLUDES_XSTRING` is added to restore legacy inclusion. MSVC-internal changes are needed due to the new internal header.
StephanTLavavej
approved these changes
May 29, 2024
Thanks - I pushed a conflict-free merge with |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for this significant throughput improvement for people who are carefully including only |
7 tasks
This was referenced Jun 6, 2024
kou
pushed a commit
to apache/arrow
that referenced
this pull request
Jun 7, 2024
### Rationale for this change I work on MSVC's STL, and we regularly build popular open-source projects, including yours, with development builds of the MSVC toolset. This allows us to find and fix toolset regressions before they affect users, and also allows us to provide advance notice of breaking changes, which is the case here. We recently merged microsoft/STL#4633 which will ship in VS 2022 17.11 Preview 3. This improved build throughput by refactoring `<string_view>` so that it no longer drags in `std::string`. It's also a source-breaking change for code that wasn't properly including `<string>`. Your `cpp/src/arrow/json/object_writer.h` declares `std::string Serialize();` without including `<string>`. When built with our updated STL, this will emit a compiler error: ``` C:\gitP\apache\arrow\cpp\src\arrow/json/object_writer.h(39): error C2039: 'string': is not a member of 'std' ``` ### What changes are included in this PR? The fix is simple and portable: include the necessary header. ### Are these changes tested? Nope, I'm totally YOLOing it. If it builds, it's good. (This will be tested in MSVC's internal "Real World Code" test infrastructure. Also, after VS 2022 17.11 ships, your existing build/test coverage will ensure that this keeps compiling.) ### Are there any user-facing changes? No. Authored-by: Stephan T. Lavavej <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
This was referenced Jun 7, 2024
BillyONeal
pushed a commit
to microsoft/vcpkg
that referenced
this pull request
Jun 10, 2024
…member of 'std' (#39160) In an internal version of Visual Studio, `arrow`, `concurrencpp` and `qtwebengine` install failed with following error: ``` arrow: \cpp\src\arrow/json/object_writer.h(39): error C2039: 'string': is not a member of 'std' concurrencpp: \include\concurrencpp/threads/thread.h(23): error C2039: 'string': is not a member of 'std' qtwebengine: \src\3rdparty\gn\src\gn\escape.h(77): error C2039: 'string': is not a member of 'std' ``` This issue caused by the STL PR: microsoft/STL#4633, and according to Stephan's suggestion, the affected files need to include the `Standard <string> header`. I have submitted an issue on the qt upstream: https://bugreports.qt.io/browse/QTBUG-126156
This was referenced Jul 31, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new header
<__msvc_string_view.hpp>
provideschar_traits
andbasic_string_view
and related utilities.<string_view>
shouldn't provide other utilities in<xstring>
. Fixes #4625.<ranges>
seemingly still need to include<xmemory>
in C++23 due toelements_of
whose default template argument depends onallocator
(see #4620).Escape hatch
_LEGACY_CODE_ASSUMES_STRING_VIEW_INCLUDES_XSTRING
is provided to restore legacy inclusion.MSVC-internal changes are needed due to the new internal header.