pr35164-2.c

来自「用于进行gcc测试」· C语言 代码 · 共 28 行

C
28
字号
struct __shared_count {    __shared_count() { _M_pi = new int; }    int * _M_pi;};template<typename _Tp>class __shared_ptr {public:    __shared_ptr(_Tp* __p);    void reset(int * __p) {        __shared_ptr(__p).swap(*this);    }    void swap(__shared_ptr<_Tp>& __other) {        __other._M_refcount._M_pi = _M_refcount._M_pi;    }    __shared_count _M_refcount;};template<typename _Tp> class shared_ptr : public __shared_ptr<_Tp> {};int main() {    for (shared_ptr<int> *iter;;)    {        try {            (iter++)->reset(new int);        }        catch (...) {        }    }}

⌨️ 快捷键说明

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