Strange MSVC behaviour with std::experimental::is_detected

后端 未结 2 2056
囚心锁ツ
囚心锁ツ 2021-01-14 23:02

I implemented std::experimental::is_detected based on this article on cppreference.com (Part of the code is below + working repro).

It works well on G++

2条回答
  •  佛祖请我去吃肉
    2021-01-14 23:49

    You need a C++11 compiler to compile the above code, and MSVC 2015 is not a C++11 compiler.

    The particular deficit in C++11 compliance you are running into is called "expression SFINAE" by microsoft. Keep an eye out for it being fixed.

    Basically, decltype cannot be used for SFINAE. In laymans terms, SFINAE is the technique you are using for selecting overloads of template functions or classes.

    There is usually no workaround.

提交回复
热议问题