-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<deque>: Make deque support incomplete element types
#2506
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
<deque>: Make deque support incomplete element types
#2506
Conversation
…to tests/std/tests/GH_000108_deque_incomplete_value_types
…omplete_value_types/env.lst
…complete_value_types/test.cpp
tests/std/tests/GH_000108_deque_incomplete_value_types/test.cpp
Outdated
Show resolved
Hide resolved
stl/inc/deque
Outdated
| _Size_type _Block = _Mycont->_Getblock(_Myoff); | ||
| _Size_type _Off = _Myoff % _Block_size; | ||
| constexpr int _Block_size = _Mydeque::_Get_block_size(); | ||
| _Size_type _Block = _Mycont->_Getblock(_Myoff); |
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.
While you are there both could be const
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.
I made index variables const when possible. But I'm not sure if there are some other variables expected to be made const.
|
|
||
| using namespace std; | ||
|
|
||
| void test_gh_000108_push_pop_size(); |
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.
Is there a reason for the separate declaration and definition of that function? We conventionally only define it before the main function
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.
I partially duplicated the test.cpp file from that of Dev10_860421.
To be honest I'm not familiar with the tests of MSVC STL and don't know what are expected to be tested...
|
Thanks for looking into this, but I don't believe that we should merge this PR, even if there's a way to make the visualizers work. As mentioned in the README's Non-Goals section, we generally avoid adding non-Standard extensions, especially significant ones. The rationale is that such extensions have maintenance costs, especially as the Standard continues to evolve, and they don't help users write portable code (in fact, they can lead to users writing code that works for MSVC, only to discover that it's non-portable - there are already many ways to do that, we just try to avoid adding more). |
This is an QoI issue at current. Given the usefulness of the feature and the feasibility in fresh implementations, it may be proposed in some future version of the standard, so it may be potentially beneficial. (And if it is not, to make the code portable, users who need this extension are enforced to do the work similar in this patch to replace the standard one.)
The changes in the patch apparently incur some costs, but the effects on the cost of long term maintenance is not definite, "especially as the Standard continues to evolve".
They don't help at current, until the guarantees are mandated in the future, which is at least, possible.
This is probably the easiest part here. The implementation can just add checks to enforce the completeness of the types by default. Then, optionally, provide a configurable macro as an extension to disable the checks, with documented guarantees and caveats on the risks of the portability. |
|
@StephanTLavavej Recently I found that libc++ has an ABI-incompatible mode ( |
Beyond our normal concern about extension behaviors, I don't want to add any more support for incomplete element types in Standard containers until WG21 solves the problem of constraining Special Member Functions for such a container. Today, We can't constrain the special member functions without unavoidable breakage for the so-called "cyclic" incomplete element type case: struct S {
std::container<S> some_structs;
};If container attempts to determine if |
|
We talked about this at the weekly maintainer meeting and have consensus to close this PR. If the Standard is changed in the future to require |
Fixes #108.
_EEN_DSin STL.natvis with a detailed expression that calculates the block size fromsizeof(value_type)._Block_sizeis turned into a local variable, so that it would not be instantiated eagerly._Uglyidentifier is introduced.