Fix folly::Expected under MSVC
authorChristopher Dykes <cdykes@fb.com>
Thu, 18 Aug 2016 19:50:37 +0000 (12:50 -0700)
committerFacebook Github Bot 9 <facebook-github-bot-9-bot@fb.com>
Thu, 18 Aug 2016 19:53:29 +0000 (12:53 -0700)
commit96e8ac5bc5d633325e85cbc1d87136ba1ce68120
tree28c4398e8dc1b4a4fa50f37d28b26a5d3b3bcc57
parent060485b60d9dc7fbada6b17f11dd2dbb63873b5e
Fix folly::Expected under MSVC

Summary:
There are 3 separate issues that this addresses to get Expected working correctly under MSVC.
The first is simply that it doesn't like `StrictConjunction`. Switching that to `std::conjunction`, which is part of C++17 and already implemented in MSVC, solves that issue.
The second is that MSVC was complaining that all members must be initialized in a `constexpr` constructor, but only one of the base classes of `ExpectedStorage` was being initialized, and, as there were no default `constexpr` constructors for the other bases, they couldn't be initialized. This was solved by making the base class's default constructors `constexpr`.
The last was the most fun, as the simple solutions all resulted in internal compiler errors. MSVC doesn't like SFINAE evaluation in the context of a template type parameter on a static operator defined inline in the class via `friend`. The solution is to simply move the definitions after the class and only include the declarations to be able to mark them as `friend`.

Reviewed By: ericniebler

Differential Revision: D3731833

fbshipit-source-id: ea9244b247b69046866f27cee9fdbd1b2405cafb
folly/Expected.h