c++-concepts

Does constraint subsumption only apply to concepts?

只愿长相守 提交于 2019-11-26 20:37:36
问题 Consider this example: template <typename T> inline constexpr bool C1 = true; template <typename T> inline constexpr bool C2 = true; template <typename T> requires C1<T> && C2<T> constexpr int foo() { return 0; } template <typename T> requires C1<T> constexpr int foo() { return 1; } constexpr int bar() { return foo<int>(); } Is the call foo<int>() ambiguous, or does the constraint C1<T> && C2<T> subsume C1<T> ? 回答1: Yes. Only concepts can be subsumed. The call to foo<int> is ambiguous because

void_t “can implement concepts”?

▼魔方 西西 提交于 2019-11-26 11:48:47
问题 I was watching the second part of Walter Brown\'s CppCon2014 talk on template metaprogramming, during which he discussed the uses of his novel void_t<> construction. During his presentation Peter Sommerlad asked him a question that I didn\'t quite understand. (link goes directly to the question, the code under discussion took place directly before that) Sommerlad asked Walter, would that mean we actually can implement concepts lite right now? to which Walter responded Oh yeah! I\'ve done it .