<xhash> should avoid including <xstring>#2996
Merged
StephanTLavavej merged 2 commits intomicrosoft:mainfrom Aug 7, 2022
Merged
<xhash> should avoid including <xstring>#2996StephanTLavavej merged 2 commits intomicrosoft:mainfrom
<xhash> should avoid including <xstring>#2996StephanTLavavej merged 2 commits intomicrosoft:mainfrom
Conversation
CaseyCarter
approved these changes
Aug 5, 2022
Member
Author
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
This file contains hidden or 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
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.

Reported by: https://www.reddit.com/r/cpp/comments/wgb8xo/fun_times_with_msvc_functional/
This does two things:
<xhash>includes<xstring>forbasic_string,<cstring>forstrlen, and<cwchar>forwcslen, because it's defining non-Standardstdextmachinery for<hash_map>and<hash_set>. This throughput cost is paid by everyone who drags in<xhash>, including highly indirect routes like<functional>. There's a simple way to avoid this (i.e. without adding a new sub-header to be included by<hash_meow>). Because we hard-deprecated<hash_meow>with an error-and-escape-hatch, we can guard thestdextmachinery with that same escape hatch. Result: thestdextmachinery and<xstring>etc. dependencies disappear for the vast majority of users, and are still available unchanged when activating the escape hatch.<unordered_meow>would make most of<string>available. As usual, the fix is to simply include<string>. Let's be daring and try to see if we can do this without totally breaking the world.stdext::hash_compareintostd, contrary to our goal of keeping non-Standard identifiers out ofstd. The project that needed this, protobuf, was fixed almost 3.5 years ago. We should be able to eliminate this now.