• Yedidya Feldblum's avatar
    Disambiguate the various in_place overloads, following C++17 · 10fb4bb8
    Yedidya Feldblum authored
    Summary:
    [Folly] Disambiguate the various `in_place` overloads, following C++17.
    
    Forwarding `folly::in_place` is ambiguous because there are multiple overloads and we depend on deduction to choose the correct overload. For example:
    
    ```lang=c++
    enum struct Err {};
    Expected<Expected<int, Err>, Err> val(in_place, in_place, 3); // fails to compile
    ```
    
    So we must disambiguate the three overloads: the default, the typed, and the indexed.
    
    C++17 defines `std::in_place`, `std::in_place_type<typename>`, and `std::in_place_index<std::size_t>`. Let us mimic that exactly, so that it becomes trivial to swap out our implementations for the standard implementations once we jump to C++17.
    
    Reviewed By: Orvid
    
    Differential Revision: D5362339
    
    fbshipit-source-id: d4012b01796390e74d8c14cdf68af70102608039
    10fb4bb8
ExceptionWrapper-inl.h 20.1 KB