C++分配连续空间的三种方法 智能指针 new


    const int nBufferSize = 1024*64;
    char *buf1 = new char[nBufferSize];
   std::unique_ptr buf2 = std::make_unique(nBufferSize);
    std::shared_ptr buf3 (new char[nBufferSize]);

 

    const int nBufferSize = 1024*64;

    char *buf1 = new char[nBufferSize];
    std::unique_ptr buf2 = std::make_unique(nBufferSize);
    std::shared_ptr buf3 (new char[nBufferSize]);

 

你可能感兴趣的:(C++)