Besides Boost, where can I get an implementation of one smart pointer to one file for C ++?

I want to start using smart pointers in my code, but I really don't want to use Boost because it is so huge.

Can anyone recommend a simple implementation of a single smart pointer to a single file?

Thanks, Boda Sido.

+3
source share
4 answers

Unfortunately, smart pointers are not so simple, so the implementation can be quite complicated. Having said that, if you use g ++, you get things like shared_ptr without using Boost:

#include <memory>
using namespace std;

int main() {
    shared_ptr <int> p( new int );
}

but you have to compile the flag -std=c++0x.

+4
source

, TR1. TR1 .

+3

- ().

, , , , , - .
, .

+1

Source: https://habr.com/ru/post/1757193/


All Articles