TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Geo
from: Mike N.
date: 2004-11-12 07:26:58
subject: Re: C++

From: Mike N. 

On Fri, 12 Nov 2004 06:06:39 -0500, "Geo"  wrote:

>>   // Declare associative array named 'senderCount' of template type map
>> keyed by string containing int values
>>   map senderCount;
>
>what is an associative array, is this a function of C++ arrays?

   It's not a built in C++ type, it is a class that implements the concept.
It's done as a  template to allow you to use any types for the values being
stored or as the keys.  Think of it as an array indexed by any type.  So
instead of

  int counts[2];
  counts[0] = 4;
  counts[1] = 7;

you have

  map counts;
  counts[555] = 4;
  counts[1832873] = 7;

  This allocates only 2 elements instead of allocating a complete linear
array from [0..1832873].


  map counts;
 string email='miken{at}example.com';
 string email2='georger{at}nls.net';
  counts[email] = 4;
  counts[email2] = 7;

The formal description is a container designed to provide direct access to
store and retrieve elements via search keys.   A map container stores
values associated with those keys.

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.