File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ namespace std {
13
13
##効果
14
14
`is_signed`は、型`T`が符号付き算術型 (cv修飾を許容する) であるならば[`true_type`](./integral_constant-true_type-false_type.md)から派生し、そうでなければ[`false_type`](./integral_constant-true_type-false_type.md)から派生する。
15
15
16
+ 符号付き算術型と見なす条件は以下:
16
17
17
- ##備考
18
- 型`T`が符号付き算術型ならば、`T(-1) < T(0)` が成立する。
18
+ - C++11 : [`is_arithmetic`](./is_arithmetic.md)`<T>::value && T(-1) < T(0)`
19
+ - C++14 : [`is_arithmetic`](./is_arithmetic.md)`<T>::value == true`の場合、[`integral_constant`](./integral_constant-true_type-false_type.md)`<bool, T(-1) < T(0)>::value`の結果を真偽の結果とする。そうでなければ偽の結果とする。
20
+ - 備考: `T`が算術型以外だった場合に、`T(0)`、`T(-1)`でテンプレートの置き換えが発生してしまうため、このような文言になっている。
19
21
20
22
21
23
##例
@@ -58,3 +60,6 @@ int main(){}
58
60
上の例でコンパイラによってはエラーになる。GCC 4.3.4, 4.5.3, Visual C++ 10.0 は ` *integral_constant ` が ` operator bool() ` を持っていないためエラーになる。
59
61
60
62
63
+ ##参照
64
+ - [ LWG Issue 2197. Specification of ` is_[un]signed ` unclear for non-arithmetic types] ( http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2197 )
65
+
Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ namespace std {
13
13
##効果
14
14
`is_unsigned`は、型`T`が符号なし算術型 (cv修飾を許容する) であるならば[`true_type`](./integral_constant-true_type-false_type.md)から派生し、そうでなければ[`false_type`](./integral_constant-true_type-false_type.md)から派生する。
15
15
16
+ 符号なし算術型と見なす条件は以下:
16
17
17
- ##備考
18
- `T`が符号なし算術型ならば、`T(0) < T(-1)` が成立する。
18
+ - C++11 : [`is_arithmetic`](./is_arithmetic.md)`<T>::value && T(0) < T(-1)`
19
+ - C++14 : [`is_arithmetic`](./is_arithmetic.md)`<T>::value == true`の場合、[`integral_constant`](./integral_constant-true_type-false_type.md)`<bool, T(0) < T(-1)>::value`の結果を真偽の結果とする。そうでなければ偽の結果とする。
20
+ - 備考: `T`が算術型以外だった場合に、`T(0)`、`T(-1)`でテンプレートの置き換えが発生してしまうため、このような文言になっている。
19
21
20
22
21
23
##例
@@ -58,3 +60,6 @@ int main(){}
58
60
上の例でコンパイラによってはエラーになる。GCC 4.3.4, 4.5.3, Visual C++ 10.0 は ` integral_constant ` が ` operator bool() ` を持っていないためエラーになる。
59
61
60
62
63
+ ##参照
64
+ - [ LWG Issue 2197. Specification of ` is_[un]signed ` unclear for non-arithmetic types] ( http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2197 )
65
+
You can’t perform that action at this time.
0 commit comments