std:: make_unsigned
| Type traits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Compile-time rational arithmetic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Compile-time integer sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
(C++14)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<type_traits>
|
||
|
template
<
class
T
>
struct make_unsigned ; |
(C++11부터) | |
만약
T
가 integral 타입(
bool
제외)이나 enumeration 타입인 경우, 동일한 cv-qualifier를 가지며
T
에 해당하는 unsigned integer 타입인
type
멤버 typedef를 제공합니다.
만약
T
가 signed 또는 unsigned
char
,
short
,
int
,
long
,
long
long
인 경우; 이 목록에서
T
에 해당하는 unsigned 타입이 제공됩니다.
만약
T
가 열거형 타입이거나
char
,
wchar_t
,
char8_t
(C++20부터)
,
char16_t
,
char32_t
인 경우; 동일한
sizeof
를 가지는 가장 작은
순위(rank)
를 가진 부호 없는 정수 타입이 제공됩니다.
|
그렇지 않으면, 동작은 정의되지 않는다. |
(until C++20) |
|
그렇지 않으면, 프로그램은 형식이 잘못되었다. |
(since C++20) |
프로그램이
std::make_unsigned
에 대한 특수화를 추가하는 경우, 동작은 정의되지 않습니다.
목차 |
멤버 타입
| 이름 | 정의 |
type
|
T
에 해당하는 부호 없는 정수형
|
헬퍼 타입
|
template
<
class
T
>
using make_unsigned_t = typename make_unsigned < T > :: type ; |
(C++14 이후) | |
예제
#include <type_traits> int main() { using uchar_type = std::make_unsigned_t<char>; using uint_type = std::make_unsigned_t<int>; using ulong_type = std::make_unsigned_t<volatile long>; static_assert( std::is_same_v<uchar_type, unsigned char> and std::is_same_v<uint_type, unsigned int> and std::is_same_v<ulong_type, volatile unsigned long> ); }
참고 항목
|
(C++11)
|
타입이 부호 있는 산술 타입인지 검사합니다
(class template) |
|
(C++11)
|
타입이 부호 없는 산술 타입인지 검사합니다
(class template) |
|
(C++11)
|
주어진 정수 타입에 해당하는 부호 있는 타입을 얻습니다
(class template) |