0x02 认识boost::scoped_ptr scoped 意为作用域,表示此智能指针...C++——智能指针auto_ptr、unique_ptr、share_ptr、weak_ptr auto_ptr 相对于普通指针分配内存,需要自己new and delete,若不delete,就会造成内存泄露。auto_ptr智能指针可以做到,指针失效时自动回收内存空间。该指针可以进行复制构造与赋值构造,...
我最近学习了指向成员语法的指针,然后编写了如下所示的程序,msvc 可以编译,但 gcc 和 clang 拒绝。 #include<iostream>#include<type_traits>#include<concepts>structC{intfoo(){return5; } };intmain(){int(C::*ptr)() = &(C::foo);//msvc compiles but not gcc and clang} ...