本文介绍了我想创建CStringArrays数组并执行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个CStringArrays数组.
如何声明和初始化此Array.

感谢您的帮助

I want to create an Array of CStringArrays.
How to declare and initialize this Array.

Thanks for your help

推荐答案

typedef std::auto_ptr<CStringArray> CSafeChapters;
typedef CArray<CSafeChapters, CSafeChapters> CCategories;

class CTest
{
  CCategories m_arCategories;

public:
  CTest()
  {
    m_arCategories.Add(CSafeCapters(new CStringArray));
    m_arCategories.Add(CSafeCapters(new CStringArray));
    m_arCategories.Add(CSafeCapters(new CStringArray));
    m_arCategories.Add(CSafeCapters(new CStringArray));

    m_arCategories[0]->Add(_T("Chapter I"));
    m_arCategories[0]->Add(_T("Chapter II"));
    m_arCategories[0]->Add(_T("Chapter III"));
  }

  ~CTest()
  { // set a breakpoint here to discover all destructors' calls by F11 key :)
  }
} cTest;



std:list

.我认为

CStringList

是不错的选择.


这篇关于我想创建CStringArrays数组并执行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-23 20:12