allocate_mapping

skylib_fluffos_v3/mudlib/doc/driver/efuns/mappings/allocate_mapping · 922 B

From the archive skylib_fluffos_v3.zip

Download the archive   « Back to the archive contents

.\"pre-allocate space for a mapping
.DT
allocate_mapping
$MUDNAME$ driver help
allocate_mapping

.SH Name
.SI 5
allocate_mapping() - pre-allocate space for a mapping
.EI

.SH Synopsis
.SI 5
mapping allocate_mapping( int size );
.EI

.SH Description
.SP 5 5
Returns a mapping with space for `size' elements preallocated.

For example:
.EP

.SI 5
mapping x;
int y = 200;

x = allocate_mapping(y);
.EI

.SP 5 5
where y is the initial size of the mapping.  Using allocate_mapping() is
the preferred way to initalize the mapping if you have some idea of how
many elements the map will contain (200 in this case).  The reason is that
allocating storage all at once is slightly more efficient.  Thus if
you are using mappings to store a soul with 200 entries, the above
initialization would be quite appropriate.  Note, that the above
initialization does not restrict you to 200 entries.
.EP

.SH See also
.SI 5
map_delete()
.EI

Site Stats

Snippets: 1791
Codebases: 571