C++相談室 part155 ..
[2ch|▼Menu]
148:デフォルトの名無しさん
21/04/09 12:20:57.67 QYkH8yRN.net
>>143
以下のサイトによれば、「標準的な仕様は決まっている」ようです:
drafet C++11 standareのsection 12.8のparagraph 15に
implicitly-defined copy/move constructor は、
「a memberwise copy/move of its bases and members」
であると書いてあるそうですから:
URLリンク(stackoverflow.com)

The implicitly-defined copy/move constructor for a non-union class X performs a memberwise copy/move of its bases and members. [ Note: brace-or-equal-initializers of non-static data members are ignored. See also the example in 12.6.2. —end note ] The order of initialization is the same as the order of initialization of bases and members in a user-defined constructor (see 12.6.2). Let x be either the parameter of the constructor or, for the move constructor, an xvalue referring to the parameter. Each base or non-static data member is copied/moved in the manner appropriate to its type:
if the member is an array, each element is direct-initialized with the corresponding subobject of x;
if a member m has rvalue reference type T&&, it is direct-initialized with static_cast(x.m);
otherwise, the base or member is direct-initialized with the corresponding base or member of x.
Virtual base class subobjects shall be initialized only once by the implicitly-defined copy/move constructor (see 12.6.2).


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

286日前に更新/299 KB
担当:undef