Why would the implicitly generated constructor (et al.) be more efficient than a user-defined (trivial) one?

前端 未结 4 1211
梦毁少年i
梦毁少年i 2020-12-20 13:04

I read this article from D. Kalev this morning about the new c++11 feature \"defaulted and deleted functions\", and can\'t understand the part about performance, namely:

4条回答
  •  有刺的猬
    2020-12-20 13:53

    To be honest, I can't see it either.

    Among other things, I can see why one should use

    class C { C() = default; };
    

    that seems to me the same as

    class C { };
    

    Or, if other constructors are provided, as:

    class C { 
        C() {}
        // other constructors.
    };
    

    I fail to see the real problem the author is writing about here.

提交回复
热议问题