Freigeben über


has_nothrow_copy-Klasse

Testet, ob Typ sich nicht auf Kopienkonstruktion auslöst.

template<class Ty>
    struct has_nothrow_copy;

Parameter

  • Ty
    Der Typ in Abfragen.

Hinweise

Eine Instanz der Typprädikatgriffe True, wenn der Typ Ty einen nothrow Kopierkonstruktor ist; andernfalls false hält er an.

Beispiel

 

// std_tr1__type_traits__has_nothrow_copy.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
struct trivial 
    { 
    int val; 
    }; 
 
struct throws 
    { 
    throws() throw(int) 
        { 
        } 
 
    throws(const throws&) throw(int) 
        { 
        } 
 
    throws& operator=(const throws&) throw(int) 
        { 
        } 
 
    int val; 
    }; 
 
int main() 
    { 
    std::cout << "has_nothrow_copy<trivial> == " << std::boolalpha 
        << std::has_nothrow_copy<trivial>::value << std::endl; 
    std::cout << "has_nothrow_copy<throws> == " << std::boolalpha 
        << std::has_nothrow_copy<throws>::value << std::endl; 
 
    return (0); 
    } 
 
  

Anforderungen

Header: <type_traits>

Namespace: std

Siehe auch

Referenz

<type_traits>

has_trivial_copy-Klasse

Weitere Ressourcen

<type_traits> Member