Mail Archives: djgpp/1997/11/12/07:43:01
On 11/12/97 1:48:09 AM sl wrote:
>Hi,
>
> It seems I am not the only one confused about Containers/Templates,
where it is their purpose,
>implementation or whatever else. Would some care to explain this to us? :)
>
> What is the purpose of Containers, what are they used for?
>
> I understand templates are used to have a Class of <insert variable
type here> so basicly I can make
>a template called Array and when using it in my program I'd go:
>
> "Array<int> dummy"
>
> And dummy would be a variable of type Array of int. Therefore the
class Array would handle int as its
>basic variable. Ok, now, what are containers? :)
>
>Gili
>
>
Hello Gili
Container is a data structure that *contains* other objects. For example,
your Array<int> above is a container of ints.
Simple C arrays are also containers since they contain objects of their
element type.
The standard library has many container classes (all in the form of a
template)
for example: vector, list, deque, set, and many more.
Eyal.
- Raw text -