Fix partial specialization problem for filesystem for Visual Studio (#2957)
* #2954: Provide std::conjunction and std::disjunction substitutes * #2954: Use conjunction and disjunction substitute to make formatter specializations for ranges and maps more robust (especially for Visual Studio compiler family) * #2954: As workaround for older MSVC compilers split formatter<std::filesystem::path> partial template specialization into two explicit specialization. * 2954: Add test case * Provide simplified implementations of conjunction and disjunction * Remove workaround explicit specializations if the partial specialization would cause an ambiguity error * Eliminate extra-test and merge it into existing std-test instead. Add conditionals for filesystem::path testing that does not run into the ambiguity problem.
This commit is contained in:
@@ -306,6 +306,24 @@ template <typename T> using type_identity_t = typename type_identity<T>::type;
|
||||
template <typename T>
|
||||
using underlying_t = typename std::underlying_type<T>::type;
|
||||
|
||||
template <typename...>
|
||||
struct disjunction : std::false_type {};
|
||||
template <typename P>
|
||||
struct disjunction<P> : P {};
|
||||
template <typename P1, typename... Pn>
|
||||
struct disjunction<P1, Pn...>
|
||||
: conditional_t<bool(P1::value), P1, disjunction<Pn...>> {
|
||||
};
|
||||
|
||||
template <typename...>
|
||||
struct conjunction : std::true_type {};
|
||||
template <typename P>
|
||||
struct conjunction<P> : P {};
|
||||
template <typename P1, typename... Pn>
|
||||
struct conjunction<P1, Pn...>
|
||||
: conditional_t<bool(P1::value), conjunction<Pn...>, P1> {
|
||||
};
|
||||
|
||||
struct monostate {
|
||||
constexpr monostate() {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user