std::is_compound
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. |
<metanoindex/>
<tbody> </tbody>| Déclaré dans l'en-tête <type_traits>
|
||
template< class T > struct is_compound; |
(depuis C++11) | |
Si
T est un type composé (qui est, un tableau, la fonction pointeur d'objet, un pointeur de fonction, le pointeur objet membre, un pointeur de fonction membre, de référence, de classe, union ou une énumération, y compris les variantes cv-qualifié), fournit du membre de constante value true égale. Pour tout autre type, value est false .Original:
If
T is a compound type (that is, array, function, object pointer, function pointer, member object pointer, member function pointer, reference, class, union, or enumeration, including any cv-qualified variants), provides the member constant value equal true. For any other type, 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.
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 a compound type , false autrement Original: true if T is a compound type , 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>
|
Notes
Types de composés sont les types qui sont construits à partir de types fondamentaux. Tout type C + + est soit fondamentale ou composé .
Original:
Compound types are the types that are constructed from fundamental types. Any C++ type is either fundamental or compound.
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.
Mise en œuvre possible
template< class T >
struct is_compound : std::integral_constant<bool, !std::is_fundamental<T>::value> {};
|
Exemple
#include <iostream>
#include <type_traits>
int main() {
class cls {};
std::cout << (std::is_compound<cls>::value
? "T is compound"
: "T is not a compound") << '\n';
std::cout << (std::is_compound<int>::value
? "T is compound"
: "T is not a compound") << '\n';
}
Résultat :
T is compound
T is not a compound
Voir aussi
(C++11) |
vérifie si un type est le type fondamental Original: checks if a type is fundamental type 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) |
vérifie si un type est de type scalaire Original: checks if a type is scalar type 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) |
vérifie si un type est le type d'objet Original: checks if a type is object type 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) |
vérifie si un type est un type tableau Original: checks if a type is an array type 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) |