在线文档教程
C++
应用 | Utilities

std::numeric_limits::is_signed

STD::数字[医]限制::IS[医]签名

static const bool is_signed;(until C++11)
static constexpr bool is_signed;(since C++11)

价值std::numeric_limits<T>::is_signed是true对于所有有符号的算术类型T和false用于无符号类型。这个常量对于所有的专门化都是有意义的。

标准专业化

Tvalue of std::numeric_limits::is_signed
/* non-specialized */false
boolfalse
charimplementation-defined
signed chartrue
unsigned charfalse
wchar_timplementation-defined
char16_tfalse
char32_tfalse
shorttrue
unsigned shortfalse
inttrue
unsigned intfalse
longtrue
unsigned longfalse
long longtrue
unsigned long longfalse
floattrue
doubletrue
long doubletrue

另见

is_signed (C++11)checks if a type is signed integer type (class template)
is_integer staticidentifies integer types (public static member constant)
is_exact staticidentifies exact types (public static member constant)
is_bounded staticidentifies types that represent a finite set of values (public static member constant)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/type/NUMERIC[医]限制/IS[医]签名