C++相談室 part62
..
32:デフォルトの名無しさん
08/05/29 00:58:06
>>29 >>31
ビルトイン型のT()は0初期化の別記法なので、
デフォルトコンストラクタとは呼ばない
テンプレートのために、ユーザー定義型のデフォルトコンストラクタと
同じ記法が使えるようにしてあるだけ
[6.2.8]
The value of an explicit use of the constructor for a builtin
type is 0 converted to that type (§4.9.5).
Thus, int() is another way of writing 0.
For a userdefined type T, T() is defined by the default
constructor (§10.4.2), if any.
The use of the constructor notation for builtin
types is particularly important when writing templates.
Then, the programmer does not know whether a template parameter
will refer to a builtin type or a userdefined
type (§16.3.4, §17.4.1.2).
次ページ最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
4767日前に更新/209 KB
担当:undef