ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [C++ Boost] Boost::Shared_Ptr
    Search: 카테고리 없음 카테고리 없음 2016. 1. 26. 11:05

    //[C++ Boost] Boost::Shared_Ptr

    //

    // 6126 jyj

    //


    #include <iostream>

    #include "boost/shared_ptr.hpp"

    #include "boost/type_traits.hpp"


    class BoostSharedptrTest01Class

    {

    public:

    void Testfun1(std::string s1)

    {

    std::cout << s1.c_str() << std::endl;

    }

    };


    void BoostSharedptrTest01Fun1()

    {

    std::cout << "fun1" << std::endl;

    }


    void Main_BoostSharedptrTest01()

    {

    {

    boost::shared_ptr<BoostSharedptrTest01Class> sp2;

    {

    boost::shared_ptr<BoostSharedptrTest01Class> sp1(new BoostSharedptrTest01Class);

    sp2 = sp1;

    }

    sp2->Testfun1("aa");

    }


    {

    //boost::shared_ptr<FILE> f1(fopen("test", "r"),fclose);

    }


    {

    //no heap obj

    boost::shared_ptr<boost::remove_pointer<HANDLE>::type> h1(FindWindow(L"Notepad",NULL), CloseHandle);

    }

    }



    댓글