Программы на C++. Форум разработчиков
-
Anonymous
Std::void_t против функции настройки при использовании SFINAE
Сообщение
Anonymous »
Код: Выделить всё
#include
template
struct CheckX
{
using TypeOfX = decltype(T::x);
using Value = void;
};
struct A
{
};
struct B
{
int x;
};
template
struct Res
{
static constexpr bool value = false;
};
// template
// struct Res
// {
// static constexpr bool value = true;
// };
template
struct Res
{
static constexpr bool value = true;
};
int main()
{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78829587/stdvoid-t-vs-customize-function-in-sfinae-usage[/url]
1722751970
Anonymous
[code]#include
template
struct CheckX
{
using TypeOfX = decltype(T::x);
using Value = void;
};
struct A
{
};
struct B
{
int x;
};
template
struct Res
{
static constexpr bool value = false;
};
// template
// struct Res
// {
// static constexpr bool value = true;
// };
template
struct Res
{
static constexpr bool value = true;
};
int main()
{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78829587/stdvoid-t-vs-customize-function-in-sfinae-usage[/url]