मैं यह पता लगाने की कोशिश कर रहा था कि नामस्थान सदस्य अस्तित्व का परीक्षण करने के लिए sfinae का उपयोग करना संभव है या नहीं। Google इसके बारे में चुप है। मैंने निम्नलिखित कोड का प्रयास किया है, लेकिन यह विफल रहता है।नामस्थान सदस्यों के अस्तित्व का परीक्षण करने के लिए sfinae का उपयोग करें
namespace xyz{
struct abc{};
}
struct abc{};
struct test_xyz{
typedef char yes;
typedef struct{ char a[2]; } no;
template <class C> static yes test(xyz::C = xyz::C()); //lets assume it has default constructor
template <class C> static no test(...);
const bool has_abc = sizeof(test_xyz::test<abc>()) == sizeof(yes);
};
कोई विचार क्यों?
सम्मान,