close

Container , 其實就是一種容器 , 而Container class就是一種class , 但是這個class是可以用來裝其他class.

像array其實就是一種container 的例子.

Container classes typically implement a fairly standardized minimal set of functionality. Most well-defined containers will include functions that:

  • Create an empty container (via a constructor)
  • Insert a new object into the container
  • Remove an object from the container
  • Report the number of objects currently in the container
  • Empty the container of all objects
  • Provide access to the stored objects
  • Sort the elements (optional)

Container classes generally come in two different varieties. 

Value containers are compositions that store copies of the objects that they are holding 

(and thus are responsible for creating and destroying those copies). 

Reference containers areaggregations that store pointers or references to other objects.

 (and thus are not responsible for creation or destruction of those objects).

 

ref : http://www.learncpp.com/cpp-tutorial/104-container-classes/

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 JerryCheng 的頭像
    JerryCheng

    KwCheng's blog

    JerryCheng 發表在 痞客邦 留言(0) 人氣()