Comparison of programming languages (associative array): Difference between revisions

Content deleted Content added
C: fact q
SmackBot (talk | contribs)
m Date maintenance tags and general fixes
Line 60:
Another 3rd party library, [http://uthash.sourceforge.net/ uthash], also creates associative arrays from C structures. A structure represents a value, and one of the structure fields acts as the key.
 
Finally, the [[Glib]] library also supports associative arrays, along with many other advanced data types and is the recommended implementation of the GNU Project{{factFact|date=December 2008}}.
 
=== ColdFusion ===
Line 128:
</source>
 
In C++, the <code>std::map</code> class is [[Generic programming#Templates in C.2B.2B|templated]] which allows the [[data type]]s of keys and values to be different for different <code>map</code> instances. For a given instance of the <code>map</code> class the keys must be of the same base type. The same must be true for all of the values. Although <code>std::map</code> is typically implemented using a [[self-balancing binary search tree]], C++'s [[Technical Report 1]] (TR1) defines a second map called <code>std::tr1::[[unordered_mapunordered map]]</code> with the algorithmic characteristics of a hash table. This is a common vendor extension to the STL as well, usually called <code>hash_map</code>, being available from such implementations as SGI and STLPort.
 
=== Cocoa/GNUstep (Objective-C) ===
Line 463:
SET NAME=""
FOR S NAME=$ORDER(^phonebook(NAME)) QUIT:NAME="" WRITE NAME," Phone Number :",^phonebook(NAME),!
 
 
 
=== OCaml ===
Line 824 ⟶ 822:
phonebook['John Doe']; #produces this -> '555-1212'
</source>
 
 
Ruby supports hash looping and iteration with the following syntax:
Line 924 ⟶ 921:
}
</source>
 
 
To access one array entry and put it on standard output