zoukankan      html  css  js  c++  java
  • c++ 智能指针

    c++11

    智能指针,不用手动删除

    #include <memory>       //For STL auto_ptr class

    std::auto_ptr<TStringList>list(new TStringList());

     list->Strings[3];

    std::auto_ptr<TStringList>sl(new TStringList());

    sl->访问成员

    sl.get();需要用到指针的时候

    ListBox1->Items->AddStrings(sl.get());否则不成功
     ListBox1->Items->AddStrings(sl);/error change to down
        std::auto_ptr<TStringList>sl(new TStringList());
        sl->Add("a");
        sl->Add("b");
        ListBox1->Items->AddStrings(sl.get());
    std::auto_ptr<TList>LocList(new TList);

    std::auto_ptr<TEdit>et(new TEdit(this));
    et->Text = ListBox1->Items->Text;
    et->CopyToClipboard();

    std::auto_ptr<TFDMemTable> table (new TFDMemTable(NULL));

  • 相关阅读:
    JavaScript闭包
    模块模式——方法
    产品与技术
    读书笔记
    屌丝求职记
    正则表达式regex狂记
    css狂记
    html狂记
    Android狂记忆
    关于调式
  • 原文地址:https://www.cnblogs.com/cb168/p/4645363.html
Copyright © 2011-2022 走看看