std::is_copy_assignable, std::is_trivially_copy_assignable, std::is_nothrow_copy_assignable
De cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Déclaré dans l'en-tête <type_traits>
|
||
template< class T > struct is_copy_assignable; |
(1) | (depuis C++11) |
template< class T > struct is_trivially_copy_assignable; |
(2) | (depuis C++11) |
template< class T > struct is_nothrow_copy_assignable; |
(3) | (depuis C++11) |
Vérifie si un type est
2) CopyAssignable
, c'est à dire accessible a un opérateur explicite ou implicite, affectation par copie. Si la condition est remplie, un membre constant value
true égalité est fourni, sinon value
est false .Original:
Checks whether a type is
CopyAssignable
, i.e. has an accessible explicit or implicit copy assignment operator. If the requirement is met, a member constant value
equal true is provided, otherwise value
is false.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Identique à 1), mais l'évaluation de l'expression de copie affectation ne sera pas appeler toute opération qui n'est pas anodin .
3) Original:
Same as 1), but evaluation of the copy-assignment expression will not call any operation that is not trivial.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Identique à 1), mais l'évaluation de l'expression de copie affectation ne sera pas appeler toute opération qui n'est pas noexcept .
Original:
Same as 1), but the evaluation of the copy-assignment expression will not call any operation that is not noexcept.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sommaire |
Inherited from std::integral_constant
Member constants
value [ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
true si T is copy-assignable, false autrement Original: true if T is copy-assignable, false otherwise The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (constante membre statique publique) |
Member functions
operator bool |
convertit l'objet en bool, retourne value Original: converts the object to bool, returns value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
Member types
Type d'
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
bool
|
type
|
std::integral_constant<bool, value> |
[modifier] Mise en œuvre possible
template< class T> struct is_copy_assignable : std::is_assignable< typename std::add_lvalue_reference<T>::type, const typename std::add_lvalue_reference<T>::type> {}; template< class T> struct is_trivially_copy_assignable : std::is_trivially_assignable< typename std::add_lvalue_reference<T>::type, const typename std::add_lvalue_reference<T>::type> {}; template< class T> struct is_nothrow_copy_assignable : std::is_nothrow_assignable< typename std::add_lvalue_reference<T>::type, const typename std::add_lvalue_reference<T>::type> {}; |
[modifier] Exemple
#include <iostream> #include <utility> #include <type_traits> struct Foo { int n; }; int main() { std::cout << std::boolalpha << "Foo is trivally copy-assignable? " << std::is_trivially_copy_assignable<Foo>::value << '\n' << "int[2] is copy-assignable? " << std::is_copy_assignable<int[2]>::value << '\n' << "int is nothrow copy-assignable? " << std::is_nothrow_copy_assignable<int>::value << '\n'; }
Résultat :
Foo is trivally copy-assignable? true int[2] is copy-assignable? false int is nothrow copy-assignable? true
[modifier] Voir aussi
(C++11) (C++11) (C++11) |
vérifie si un type a un opérateur d'affectation d'un argument spécifique Original: checks if a type has a assignment operator for a specific argument The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe générique) |
(C++11) (C++11) (C++11) |
vérifie si un type a un opérateur d'affectation mouvement Original: checks if a type has a move assignment operator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe générique) |