No announcement yet.

Container Library Sequences in C++ Simplified

  • Filter
  • Time
  • Show
Clear All
new posts

  • Container Library Sequences in C++ Simplified

    I assume you can use the C++ array. If you want more from an array, then you have to use what is called, a Sequence Container. In this article, I introduce you to a tutorial series on Sequence Containers. In the tutorial series, they are called container sequences (change in word order).

    Limitations of the Array
    Imagine that you want to delete the element of a C++ array. That is not possible. You can set the value of a C++ array to NULL, but you cannot delete the element. Imagine that, you want to add an element (with value) to the top of the array. That is not possible. Imagine that you want to add an element (with value) to the bottom of an array. That is still not possible with the C++ array. Those and other requirements are needed in modern programs.

    Solution to the limitations of the C++ Array
    Because of the limitations above, C++ came up with the container sequences. There are different forms of the container. One of them called, the vector, will solve the above problems and more. Each container sequence has its advantages and disadvantages.

    C++ is a complete language. Nothing is really left out. If you have studied a new language like JavaScript, you would have noticed that its array is actually an object, which solves the above problems with methods. The C++ array is not an object in the strict sense of the word. However, in C++, the container sequences are objects. C++ is an old language and so it approached this problem from an original point of view. In my opinion, the authors (inventors) of some of the new languages got their inspiration from C++. Then they came up with compromises. They cane up with arrays that are objects; that would do many of the things that C++ containers do, but not all. In fact, JavaScript in particular, does not have any equivalent to the sequence container. Let me point out here that JavaScript, was not written for the same purpose as C++; maybe that is why it is not as powerful.

    C++ has stood the test of time and it is competing fiercely with the new languages. So, I strongly advise you to study container sequences. There is another set of containers to learn, but start with the container sequences first.

    The tutorial series has been written in a step-by-step fashion. The code samples are well formatted with good indentation, making readability very easy. There are no missing special characters, as you would find in other sites. The links to the different parts of the series are easily accessible. Click the following link to start the series:


    Last edited by DPS Computing; 29-01-2012, 22:42. Reason: Possible spam - many messages with numerous links pasted in. Possible copy/paste