1.全局的智能指针数组
1.1声明
static std::vector<std::unique_ptr<sThkabc>> m_vSubSys;
1.2定义
std::vector<std::unique_ptr<sThkabc>> ThkSubSysDefCfg::m_vSubSys;
1.3存数据
for (int i = 0; i < (int)arrInfo->GetCount(); i++)
{
CStringArray* pStrArr = arrInfo->GetAt(i);
if (pStrArr == NULL || pStrArr->GetCount() < 2)
{
continue;
}
unique_ptr<sThkabc> sMdlCfg = make_unique<sThkabc>();
sMdlCfg->m_strSubSysName = pStrArr->GetAt(0);
sMdlCfg->m_strSubSysPrefix = pStrArr->GetAt(1);
m_vSubSys.push_back(move(sMdlCfg));
}
1.4取出数据
for (int i=0;i<Thkabc::m_vSubSys.size();i++)
{
unique_ptr<sThkabc>& pSubSys = Thkabc::m_vSubSys[i];
if (pSubSys==NULL)
{
continue;
}
ThkListIndex nIdx = m_List.AddRow(pSubSys->m_strSubSysName);
m_List.SetItemText(nIdx, 1,m_Man.m_strPrefix+ pSubSys->m_strSubSysPrefix);
}