如何检查这些结构是否具有名为Foo“的特定类型?

#include <iostream>

/****我在这里搞混了*/

template <typename T>
struct hasTypeFoo {

//..    
static constexpr bool value = true;

};

/////////////////////////////////////////////////

struct A {

    using Foo = int;

};

struct B {


};
int main()
{

    constexpr bool b1 = hasTypeFoo<A>::value;
    constexpr bool b2 = hasTypeFoo<B>::value;

    std::cout << b1 << b2;
}

转载请注明出处:http://www.mlhpz.com/article/20230523/2280920.html