Condividi tramite


has_nothrow_constructor Class

Verificare se il tipo non è generato su costruzione predefinita.

template<class Ty>
    struct has_nothrow_constructor;

Parametri

  • Ty
    Il tipo da eseguire la query.

Note

Un'istanza del predicato del tipo per poter se il tipo Ty dispone di un costruttore predefinito di nothrow contenuta in caso contrario, false.

Esempio

 

// std_tr1__type_traits__has_nothrow_constructor.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_constructor<trivial> == " << std::boolalpha 
        << std::has_nothrow_constructor<trivial>::value << std::endl; 
    std::cout << "has_nothrow_constructor<throws> == " << std::boolalpha 
        << std::has_nothrow_constructor<throws>::value << std::endl; 
 
    return (0); 
    } 
 
  

Requisiti

intestazione: <type_traits>

Spazio dei nomi: deviazione standard

Vedere anche

Riferimenti

<type_traits>

has_trivial_constructor Class

Altre risorse

<type_traits> membri