Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-45591

Improve is_copy_constructible calls in future impl

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Fully Compatible
    • Service Arch 2020-03-23, Service Arch 2020-04-06, Service arch 2020-05-04, Service arch 2020-05-18
    • 0

      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

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            mira.carey@mongodb.com Mira Carey
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: