Why void_t doesnt work in SFINAE but enable_if does

前端 未结 1 1764
难免孤独
难免孤独 2021-01-01 16:19

I was trying to understand how SFINAE works and I was experimenting with this code

#include 

struct One { 
  using x = int;          


        
相关标签:
1条回答
  • 2021-01-01 16:36

    This seems to be related to CWG issue #1980 (credits to T.C. for correcting me).

    As a workaround you can define void_t as:

    template<typename... Ts> struct make_void { typedef void type;};
    template<typename... Ts> using void_t = typename make_void<Ts...>::type;
    

    (from cppreference)

    live example on wandbox

    0 讨论(0)
提交回复
热议问题