Giter VIP home page Giter VIP logo

Comments (2)

EzoeRyou avatar EzoeRyou commented on July 17, 2024

それは意図的なものです。
定義というのは、実行時のことで、コンパイル時にはとくに関係がありません。

On 11/21/13, inouaTI [email protected] wrote:

{ } の記入漏れ4ヶ所。

12.6.1 明示的な初期化(Explicit initialization)

【24990 行】

 struct X
 {
-    X( int ) ;
+    X( int ) { }
-    X( int, int ) ;
+    X( int, int ) { }
-    X( int, int, int ) ;
+    X( int, int, int ) { }
 } ;
 int main()
 {
    X x1( 1 ) ; // X::X(int)
    X x2( 1, 2 ) ; // X::X(int,int)
    X x3( 1, 2, 3 ) ; // X::X(int,int,int)
 }

詳しくは、初期化子の直接初期化を参照。

また、=(イコール)記号に続いて値を指定することで、初期化することもできる。

 struct X
 {
-    X( int ) ;
+    X( int ) { }
 } ;
 int main()
 {
    X x = 0 ; // X::X(int)
 }

Reply to this email directly or view it on GitHub:
#152

Ryou Ezoe

Blog: http://cpplover.blogspot.com/
Twitter: https://twitter.com/EzoeRyou
GitHub: https://github.com/EzoeRyou

from cpp-book.

inouaTI avatar inouaTI commented on July 17, 2024

「クラスのオブジェクトの初期化子には括弧に囲まれた式リストを使うことができる。この場合、適切な仮引数リストのコンストラクターによって初期化される。 」
の解説文で、
「この場合、適切な仮引数リストのコンストラクターによって初期化される。 」
という所の解説ですね。
済みませんよく読みませんでした。

from cpp-book.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.