Skip to content
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

<hash_set|hash_map>: Add opt-out to the stdext namespace #5228

Open
tiagomacarios opened this issue Jan 9, 2025 · 2 comments
Open

<hash_set|hash_map>: Add opt-out to the stdext namespace #5228

tiagomacarios opened this issue Jan 9, 2025 · 2 comments
Labels
enhancement Something can be improved

Comments

@tiagomacarios
Copy link
Member

Perhaps a feature request (or a conformance bug) - Would it be possible to make the stdext disappear behind a control macro?
_HAS_STDEXT_NAMESPACE = 1 -> current behavior
_HAS_STDEXT_NAMESPACE = 0 -> stdext is removed by the preprocessor

This would enable large codebases from prevent users from using this features. It would also enable us to eventually default to 0 and have users need to opt-in until this is completely removed.

@StephanTLavavej
Copy link
Member

<hash_map> and <hash_set> are specifically blocked with a hard #error until the user defines a macro, so it's impossible to use them accidentally:

STL/stl/inc/hash_map

Lines 19 to 22 in 0408152

#ifndef _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#error <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define \
_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to suppress this error.
#endif // _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS

For the other stdext namespace stuff, which we've been working on deprecating, adding a mode to control its existence (like tr1) entirely seems reasonable.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jan 9, 2025
@frederick-vs-ja
Copy link
Contributor

In <exception>, it seems that the stdext emulates inline namespace and allows TUs with exception turned on/off to be linked together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

No branches or pull requests

3 participants