ref7.c

来自「this is a gcc file, you can download it 」· C语言 代码 · 共 22 行

C
22
字号
// Testcase for the lifetime of a temporary object which is used to// initialize a reference.int destroyed = 0;struct A {  A() { }  A(int) { }  ~A() { destroyed++; }};A a;A foo () { return a; }int main(){  const A& ar = foo();  const A& ar2 = A();  const A& ar3 = (A)1;  return destroyed;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?