简单的Map类模版.docxVIP

  • 5
  • 0
  • 约2.04千字
  • 约 3页
  • 2023-07-14 发布于上海
  • 举报
简单的 Map 类模版 #include string #include iostream using namespace std; templatetypename T1, typename T2 class Map { public: Map() : m_nElemCount(0) { } Map(Map m) { m_nElemCount = m.m_nElemCount; for (int i = 0; i m.m_nElemCount; i++) { this- ModifyElem(m.m_tFirst[i], m.m_tSecond[i], i); } } ~Map(){} bool Insert(const T1 tFirst, const T2 tSecond) { if (m_nElemCount == SIZE) { return false; } if (this- FindSubscript(tFirst) != -1) { } else { } return false; this- ModifyElem(tFirst, tSecond, m_nElemCount); m_nElemCount++; return true; } bool Erase(const T1 tFirst) { int nSubscript = this- Find

文档评论(0)

1亿VIP精品文档

相关文档