Sdílet prostřednictvím


has_nothrow_constructor Class

Zkoušky, pokud není typ vyvoláním výchozí konstrukcí.

template<class Ty>
    struct has_nothrow_constructor;

Parametry

  • Ty
    Typ dotazu.

Poznámky

Instanci typu predikát obsahuje PRAVDA, pokud typ Ty má nothrow výchozí konstruktor, jinak má hodnotu false.

Příklad

 

// 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); 
    } 
 
  

Požadavky

Záhlaví: <type_traits>

Obor názvů: std

Viz také

Referenční dokumentace

<type_traits>

has_trivial_constructor Class

Další zdroje

<type_traits> Členové