[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments
yingpo.liao at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed May 13 20:22:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66092
--- Comment #1 from Ying-Po Liao <yingpo.liao at gmail dot com> ---
Here's another implementation, which results in the same consequence.
template <typename T, typename U, typename... Args>
struct Checker
{
constexpr static decltype(auto) check( std::true_type )
{ return std::integral_constant<bool, __is_same_as(T, U)>(); }
constexpr static decltype(auto) check( std::false_type )
{ return std::integral_constant<bool, __is_same_as(T, U)
&& Checker<U, Args...>::value>(); }
constexpr static bool value = decltype(
check( std::integral_constant<bool, (sizeof...(Args)==0)>() )
)::value;
};
template <typename T, typename U, typename... Args>
concept bool Same()
{
return Checker<T, U, Args...>::value;
}
More information about the Gcc-bugs
mailing list