-
Notifications
You must be signed in to change notification settings - Fork 1.6k
P1518R2 Stop Overconstraining Allocators In Container Deduction Guides #2032
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5ff2336
trying to implement P1518R2
fsb4000 e7156e3
delete empty lines
fsb4000 c4715a2
delete one more empty line
fsb4000 919d446
miss `const`
fsb4000 c40419f
fix formatting
fsb4000 34c5de5
delete last empty line
fsb4000 0c61b02
comment out unused parameter
fsb4000 d6cb3fc
omit unused parameter
fsb4000 96fd1a3
add test for vector bool
fsb4000 6e1bb65
Merge branch 'fix1974' of https://github.com/fsb4000/STL into fix1974
fsb4000 d355e8b
add more tests
fsb4000 1ea4df3
Merge branch 'main' into fix1974
fsb4000 95715bf
Address review comments
fsb4000 a3ea9ba
Drop `extern` for the internal test harness.
StephanTLavavej File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
4 changes: 4 additions & 0 deletions
4
tests/std/tests/P1518R2_stop_overconstraining_allocators/env.lst
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| RUNALL_INCLUDE ..\usual_17_matrix.lst |
137 changes: 137 additions & 0 deletions
137
tests/std/tests/P1518R2_stop_overconstraining_allocators/test.compile.pass.cpp
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| #include <deque> | ||
| #include <forward_list> | ||
| #include <functional> | ||
| #include <list> | ||
| #include <map> | ||
| #include <memory_resource> | ||
| #include <queue> | ||
| #include <set> | ||
| #include <stack> | ||
| #include <unordered_map> | ||
| #include <unordered_set> | ||
| #include <utility> | ||
| #include <vector> | ||
|
|
||
| using namespace std; | ||
|
|
||
| pmr::monotonic_buffer_resource mr; | ||
|
|
||
| template <template <class...> class Ctr> | ||
| struct SfinaeTester { | ||
| template <class... Args> | ||
| static auto f(int, Args&&... args) -> decltype(Ctr(static_cast<Args&&>(args)...)) { | ||
| return Ctr(static_cast<Args&&>(args)...); | ||
| } | ||
| template <class... Args> | ||
| static void f(long, Args&&...) {} | ||
|
|
||
| template <class... Args> | ||
| static auto test(Args&&... args) { | ||
| return f(0, static_cast<Args&&>(args)...); | ||
| } | ||
| }; | ||
|
|
||
| void test_deque(pmr::deque<int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<deque>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<deque>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_forward_list(pmr::forward_list<int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<forward_list>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<forward_list>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_list(pmr::list<int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<list>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<list>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_vector(pmr::vector<int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<vector>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<vector>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_vector_bool(pmr::vector<bool>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<vector>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<vector>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_map(pmr::map<int, int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<map>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<map>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_multimap(pmr::multimap<int, int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<multimap>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<multimap>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_multiset(pmr::multiset<int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<multiset>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<multiset>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_set(pmr::set<int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<set>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<set>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_unordered_map(pmr::unordered_map<int, int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<unordered_map>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<unordered_map>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_unordered_multimap(pmr::unordered_multimap<int, int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<unordered_multimap>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<unordered_multimap>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_unordered_multiset(pmr::unordered_multiset<int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<unordered_multiset>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<unordered_multiset>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_unordered_set(pmr::unordered_set<int>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<unordered_set>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<unordered_set>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_priority_queue1(priority_queue<int, pmr::vector<int>>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<priority_queue>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<priority_queue>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_queue1(queue<int, pmr::deque<int>>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<queue>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<queue>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_stack1(stack<int, pmr::vector<int>>& px) { | ||
| [[maybe_unused]] auto x = SfinaeTester<stack>::test(px, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<stack>::test(move(px), &mr); | ||
| } | ||
|
|
||
| void test_priority_queue2(less<int> comp, pmr::vector<int>& pc) { | ||
fsb4000 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [[maybe_unused]] auto x = SfinaeTester<priority_queue>::test(comp, pc, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<priority_queue>::test(comp, move(pc), &mr); | ||
fsb4000 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| void test_priority_queue3(int* begin, int* end, less<int> comp, pmr::vector<int>& pc) { | ||
| [[maybe_unused]] auto x = SfinaeTester<priority_queue>::test(begin, end, comp, pc, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<priority_queue>::test(begin, end, comp, move(pc), &mr); | ||
| } | ||
|
|
||
| void test_queue2(pmr::deque<int>& pc) { | ||
| [[maybe_unused]] auto x = SfinaeTester<queue>::test(pc, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<queue>::test(move(pc), &mr); | ||
| } | ||
|
|
||
| void test_stack2(pmr::vector<int>& pc) { | ||
| [[maybe_unused]] auto x = SfinaeTester<stack>::test(pc, &mr); | ||
| [[maybe_unused]] auto y = SfinaeTester<stack>::test(move(pc), &mr); | ||
| } | ||
|
|
||
| int main() {} // COMPILE-ONLY | ||
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.
Uh oh!
There was an error while loading. Please reload this page.