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

Implement makeStatusWith<T> factory function

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.1.1
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Fully Compatible
    • Platform 1 04/03/15

      This would be analogous to std::make_unique/make_shared/make_optional

      There would be two overloads - one that takes a variadic pack and forwards it to T's constructor, returning an engaged StatusWith<T>.

      The second would take an errorCode and return a disengaged StatusWith<T>.

      This would make it possible to write:

      return makeStatusWith<StringData>{str, len};
      

      instead of:

      return StatusWith<StringData>{StringData{str, len}};
      

      Tack on work: add an of overload uassertStatusOK that takes a StatusWith<T>

            Assignee:
            adam.midvidy Adam Midvidy
            Reporter:
            adam.midvidy Adam Midvidy
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: