Я пытался выяснить, можно ли использовать Sfinae для тестирования пространства имен < /strong>. Я попробовал следующий код, но он терпит неудачу. < /P>
namespace xyz{
struct abc{};
}
struct abc{};
struct test_xyz{
typedef char yes;
typedef struct{ char a[2]; } no;
template static yes test(xyz::C = xyz::C()); //lets assume it has default constructor
template static no test(...);
const bool has_abc = sizeof(test_xyz::test()) == sizeof(yes);
};
< /code>
Есть идеи почему? < /p>
С уважением, < /p>
Подробнее здесь: https://stackoverflow.com/questions/360 ... -existence