This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments
- From: "yingpo.liao at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 May 2015 20:22:52 +0000
- Subject: [Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments
- Auto-submitted: auto-generated
- References: <bug-66092-4 at http dot gcc dot gnu dot org/bugzilla/>
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;
}