# __has_trivial_assign

*Go Up to Type Trait Functions (C++11) Index*

**Category**

Type Trait Functions

**Syntax**

bool __has_trivial_assign (typename T )

Returns true if and only if T has a trivial copy assignment operator.

**Error** if T is an incomplete type.

The definition from Section 20.4.4.3 of the Working Draft notes says a type T has a trivial copy assignment operator if T is neither const nor a reference type and T is one of:

- a scalar type (or array thereof)
- a class type with a trivial copy assignment operator

According to Section 21.8 p11 of the Working Draft, a copy assignment operator for class X is trivial if:

- It is not user provided
- class X has no virtual functions
- class X has no virtual base classes
- each direct base class of X has a trivial copy assignment operator.
- for all the non-static data members of X that are of class type (or array thereof), each such class type has a trivial copy assignment operator;

A copy assignment operator is not user provided if it is implicitly declared, or defined inline as = default;.

**Ox interaction** false if the copy assign operator is defined as deleted.

**Ox interaction** false if the default constructor is defined as deleted.

**Ox interaction** with default function definitions.