を私が質問に@bolovの最初の受け入れ答えを理解しようとDeleted default constructor. Objects can still be created... sometimes私はそこに誤りを見つけたので、それが台無しのように[1] に思えます説明全体。 シナリオ struct foo {
foo() = delete;
};
// All bellow OK
私はデフォルト-初期対値 - 初期の私の理解をリフレッシュし、this出くわした: struct C {
int x;
int y;
C() { }
};
int main() {
C c = C();
}
C(の場合は理由 どうやらこれはUBである)があり、 xおよびyメンバーを初期化することができるコンストラクタです。初期化は行われません。
私はこのような関数を作成できる言語のようなJavascriptから来ています。 function tween(obj, tweenParams, time, tweenOptions);
これは同様に使用されている:それは明確ではない場合、これは1秒の遅延で5回ループし、1秒にわたって10にmySpriteがのxおよびyプロパティをlerps tween(mySprite, {x: 10, y
可能性の重複: non-copyable objects and value initialization: g++ vs msvc Value-initializing an automatic object? 次の文考えてみましょう: をそれは本当に不可能です自動の値初期化へオブジェクト。 このステートメントは正しいですか? int main()
{
int i = int();
#include <iostream>
struct A {
int x;
};
void foo(A a) {
std::cout << a.x << std::endl;
}
int main() {
A a;
foo(a); // -7159156; a was default-initialized
foo(A()); //
可能性の重複: What do the following phrases mean in C++: zero-, default- and value-initialization? 私は、例えば、クラスを持っている場合:私が作成したオブジェクトに使用 class Info
{
int x;
int y;
};
、 Info *p = new Info();
情報