This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments


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;
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]