delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/12/07:43:01

From: eyal DOT ben-david AT aks DOT com
To: SL AT usemail DOT com
cc: djgpp AT delorie DOT com
Message-ID: <4225654D.004106E6.00@aks.com>
Date: Wed, 12 Nov 1997 14:38:01 +0200
Subject: Re: Containers/Templates etc
Mime-Version: 1.0




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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019