Skip to content

Modern Map Reserve

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Map › Map › Reserve

Reserve

Makes room for n entries, so filling the map does not have to regrow it.

Syntax

Reserve( byval n as int32 )

Notes

  • O(n)

Examples

#import "std/containers"
using containers

dim ages as Map( of ustring, integer )

'' Size it once up front and the fill does no rehashing
ages.Reserve( 1000 )
print ages.Capacity              '' 2048 -- power of two, with room for
                                 '' the 0.75 load factor
print ages.Count                 '' 0

Library: Map
Category: Map
Documented under: Members

Clone this wiki locally