has_nothrow_assign (Clase)

Comprueba si el tipo no produce de asignación.

template<class Ty>
    struct has_nothrow_assign;

Parámetros

  • Ty
    El tipo a ver.

Comentarios

Una instancia de predicado de tipo es true si el tipo Ty tiene un operador de asignación de copia nothrow, si no se considera false.

Una función nothrow es una función que tiene un especificador vacío throw, o una función que el compilador pueda determinar de otra forma no producirá una excepción.

Ejemplo

 

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

Requisitos

Encabezado: <type_traits>

Espacio de nombres: std

Vea también

Referencia

<type_traits>

has_trivial_assign (Clase)

Otros recursos

miembros de <type_traits>