-
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 7 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 |
107 changes: 107 additions & 0 deletions
107
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,107 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <deque> | ||
#include <forward_list> | ||
#include <list> | ||
#include <map> | ||
#include <memory_resource> | ||
#include <queue> | ||
#include <set> | ||
#include <stack> | ||
#include <unordered_map> | ||
#include <unordered_set> | ||
#include <vector> | ||
|
||
using namespace std; | ||
|
||
extern 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&&... /*args*/) {} | ||
fsb4000 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
template <class... Args> | ||
static auto test(Args&&... args) { | ||
return f(0, static_cast<Args&&>(args)...); | ||
} | ||
}; | ||
|
||
auto test_deque(pmr::deque<int>& px) { | ||
auto x = SfinaeTester<deque>::test(px, &mr); | ||
} | ||
|
||
auto test_forward_list(pmr::forward_list<int>& px) { | ||
auto x = SfinaeTester<forward_list>::test(px, &mr); | ||
} | ||
|
||
auto test_list(pmr::list<int>& px) { | ||
auto x = SfinaeTester<list>::test(px, &mr); | ||
} | ||
|
||
auto test_vector(pmr::vector<int>& px) { | ||
auto x = SfinaeTester<vector>::test(px, &mr); | ||
} | ||
|
||
auto test_map(pmr::map<int, int>& px) { | ||
auto x = SfinaeTester<map>::test(px, &mr); | ||
} | ||
|
||
auto test_multimap(pmr::multimap<int, int>& px) { | ||
auto x = SfinaeTester<multimap>::test(px, &mr); | ||
} | ||
|
||
auto test_multiset(pmr::multiset<int>& px) { | ||
auto x = SfinaeTester<multiset>::test(px, &mr); | ||
} | ||
|
||
auto test_set(pmr::set<int>& px) { | ||
auto x = SfinaeTester<set>::test(px, &mr); | ||
} | ||
|
||
auto test_unordered_map(pmr::unordered_map<int, int>& px) { | ||
auto x = SfinaeTester<unordered_map>::test(px, &mr); | ||
} | ||
|
||
auto test_unordered_multimap(pmr::unordered_multimap<int, int>& px) { | ||
auto x = SfinaeTester<unordered_multimap>::test(px, &mr); | ||
} | ||
|
||
auto test_unordered_multiset(pmr::unordered_multiset<int>& px) { | ||
auto x = SfinaeTester<unordered_multiset>::test(px, &mr); | ||
} | ||
|
||
auto test_unordered_set(pmr::unordered_set<int>& px) { | ||
auto x = SfinaeTester<unordered_set>::test(px, &mr); | ||
} | ||
|
||
auto test_priority_queue1(priority_queue<int, pmr::vector<int>>& px) { | ||
auto x = SfinaeTester<priority_queue>::test(px, &mr); | ||
} | ||
|
||
auto test_queue1(queue<int, pmr::deque<int>>& px) { | ||
auto x = SfinaeTester<queue>::test(px, &mr); | ||
} | ||
|
||
auto test_stack1(stack<int, pmr::vector<int>>& px) { | ||
auto x = SfinaeTester<stack>::test(px, &mr); | ||
} | ||
|
||
auto test_priority_queue2(less<int> comp, pmr::vector<int>& pc) { | ||
auto x = SfinaeTester<priority_queue>::test(comp, pc, &mr); | ||
} | ||
|
||
auto test_queue2(pmr::deque<int>& pc) { | ||
auto x = SfinaeTester<queue>::test(pc, &mr); | ||
} | ||
|
||
auto test_stack2(pmr::vector<int>& pc) { | ||
auto x = SfinaeTester<stack>::test(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.