typetraits पर टैग किए गए जवाब

5
`Is_base_of` कैसे काम करता है?
निम्नलिखित कोड कैसे काम करता है? typedef char (&yes)[1]; typedef char (&no)[2]; template <typename B, typename D> struct Host { operator B*() const; operator D*(); }; template <typename B, typename D> struct is_base_of { template <typename T> static yes check(D*, T); static no check(B*, int); static const bool value = …

1
क्यों std :: is_pod C ++ 20 में पदावनत है?
std::is_podसंभवतः C ++ 20 में पदावनत किया जाएगा। इस पसंद का कारण क्या है? यह std::is_podजानने के लिए कि एक प्रकार का POD है या नहीं, यह जानने के लिए मुझे क्या उपयोग करना चाहिए ?
92 c++  typetraits 


1
std :: is_constructible निजी कंस्ट्रक्टर के लिए असंगत मूल्य देता है
ऐसे कौन से नियम हैं जिनके द्वारा std::is_constructibleनिजी निर्माणकर्ता को संभालते हैं? निम्नलिखित कोड दिया गया है: #include <iostream> class Class { private: Class() { } }; template <typename T> class Test { public: static void test() { std::cout //<< std::is_constructible<Class>::value << std::is_constructible<T>::value << std::endl; } }; int main() { …
13 c++  typetraits 

1
Is_nothrow_constructible के gcc के कार्यान्वयन में static_cast की आवश्यकता क्यों है?
जीसीसी के कार्यान्वयन से लिया गया type_traitsक्यों static_castयहाँ की आवश्यकता है? template <typename _Tp, typename... _Args> struct __is_nt_constructible_impl : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> {}; template <typename _Tp, typename _Arg> struct __is_nt_constructible_impl<_Tp, _Arg> : public integral_constant<bool, // Why is `static_cast` needed here? noexcept(static_cast<_Tp>(declval<_Arg>()))> {};

3
निम्नलिखित मामले में आश्रित प्रकारों के लिए टाइपनेम का उपयोग करने की आवश्यकता क्यों नहीं है?
मैं, एक प्रकार का संदर्भ हटाने के बारे में पढ रहा हूं यहां । यह निम्नलिखित उदाहरण देता है: #include <iostream> // std::cout #include <type_traits> // std::is_same template<class T1, class T2> void print_is_same() { std::cout << std::is_same<T1, T2>() << '\n'; } int main() { std::cout << std::boolalpha; print_is_same<int, int>(); print_is_same<int, …
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.