◐ Shell
clean mode source ↗

std::make_unsigned — cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Déclaré dans l'en-tête

<type_traits>

template< class T > struct make_unsigned;

(depuis C++11)

Compte tenu d'une intégrale (sauf bool) ou T type d'énumération, fournit la type membre typedef qui est le type entier non signé correspondant à T, avec le même CV-qualification .

Original:

Given an integral (except bool) or enumeration type T, provides the member typedef type which is the unsigned integer type corresponding to T, with the same cv-qualifiers.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Types de membres

Nom

Original:

Name

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Definition
type

le type entier non signé correspondant à T

Original:

the unsigned integer type corresponding to T

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Exemple

#include <iostream>
#include <type_traits>

int main() {
    typedef std::make_unsigned<char>::type char_type;
    typedef std::make_unsigned<int>::type int_type;
    typedef std::make_unsigned<volatile long>::type long_type;

    bool ok1 = std::is_same<char_type, unsigned char>::value; 
    bool ok2 = std::is_same<int_type, unsigned int>::value;
    bool ok3 = std::is_same<long_type, volatile unsigned long>::value;
    
    std::cout << std::boolalpha
    << "char_type is 'unsigned char'?          : " << ok1 << '\n'
    << "int_type  is 'unsigned int'?           : " << ok2 << '\n'
    << "long_type is 'volatile unsigned long'? : " << ok3 << '\n';
}

Résultat :

char_type is 'unsigned char'?          : true
int_type  is 'unsigned int'?           : true
long_type is 'volatile unsigned long'? : true

Voir aussi

(C++11)

vérifie si un type est signée type arithmétique

Original:

checks if a type is signed arithmetic 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) [edit]

(C++11)

vérifie si un type est le type arithmétique non signée

Original:

checks if a type is unsigned arithmetic 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) [edit]

(C++11)

rend le type de donnée intégrale signé

Original:

makes the given integral type signed

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) [edit]