has_nothrow_copy Class
Тесты, если тип не выдает на проектирование копии.
template<class Ty>
struct has_nothrow_copy;
Параметры
- Ty
Тип для запроса.
Заметки
Экземпляр предиката типа выполняются, если тип Ty содержит конструктор копии nothrow, в противном случае он хранит false.
Пример
// 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);
}
Требования
заголовок:<type_traits>
пространство имен: STD