[SERVER-45591] Improve is_copy_constructible calls in future impl Created: 15/Jan/20 Updated: 29/Oct/23 Resolved: 04/May/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 4.7.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Mira Carey | Assignee: | Spencer Brody (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Sprint: | Service Arch 2020-03-23, Service Arch 2020-04-06, Service arch 2020-05-04, Service arch 2020-05-18 | ||||
| Participants: | |||||
| Linked BF Score: | 0 | ||||
| Description |
|
Our future's code makes use of a std::is_copy_constructible_v call inside fillChildren to avoid attempting to instantiate implementations for move only T's. There are also a few other static_asserts that check the same parameter. The problem is that for every T, std::is_copy_constructible_v<std::vector<T>> == true, because std::vector is a crappy old type and always has a copy constructor (it just can't be instantiated for move only types). This causes our static_asserts to be worthless, and for Future<vector<MoveOnly>> to be uninstantiatable. We should add some kind of util::is_actually_copy_constructible_v that has a special case for vector, and for anything else we end up finding, and use that instead. If we don't do that, the workaround is to wrap your vector's in types that you explicitly make move only, which isn't the best ergonomics |
| Comments |
| Comment by Githook User [ 04/May/20 ] |
|
Author: {'name': 'Spencer T Brody', 'email': 'spencer@mongodb.com', 'username': 'stbrody'}Message: |
| Comment by Githook User [ 30/Apr/20 ] |
|
Author: {'name': 'Spencer T Brody', 'email': 'spencer@mongodb.com', 'username': 'stbrody'}Message: |
| Comment by Billy Donahue [ 23/Apr/20 ] |
|
Reopening just to get my CR comments looked at. Sorry I was too late with them. We'll probably need another CR to roll it back or at least fix some problems with it (like opening the anonymous namespace in the header). |
| Comment by Githook User [ 23/Apr/20 ] |
|
Author: {'name': 'Spencer T Brody', 'email': 'spencer@mongodb.com', 'username': 'stbrody'}Message: |