Name

dict_new — Creates a new dictionary to store key-value pairs.

Synopsis

dictionary dict_new ( in size integer );

Description

This function creates a new dictionary. A dictionary is a memory-resident hash table that can store an arbitrary number of key-value pairs. Both key and dependent part can be of any type, including vectors. Two keys of different data types are always considered as different even if SQL '=' operator return 'true', e.g. integer zero and double precision 0.0 are two different keys. Vectors are equivalent if their corresponding members are either equal scalars or equivalent vectors. XML entities are equivalent if they refer to the same node or attribute in the same document.

Dictionary objects are always passed by reference, even if dictionary is passed as an 'in' argument of a function. If value of a variable is a dictionary and it is assigned to other variable then both variables refer to the same internal hashtable. To create two really independent dictionary objects, use dict_duplicate () .

Parameters

size

The guessed side of hashtable. overestimation of the size will result in needless memory consumption whereas underscore leads to a bit slower insertion, because the internal hash table will grow dynamically. The simplest approach is to omit the parameter at all if you don't know the number of keys to be stored.

Return Types

The function returns a new empty dictionary object.