Skip to content

Modern Set Reserve

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

Home › Set › Set › Reserve

Reserve

Makes room for n values, so filling the set does not have to regrow it.

Syntax

Reserve( byval n as int32 )

Notes

  • O(n)

Examples

#import "std/containers"
using containers

dim seen as Set( of integer )

seen.Reserve( 1000 )
print seen.Capacity          '' 2048 -- sized so the 0.75 load factor
                             '' still fits 1000 elements without a rehash
print seen.Count             '' 0

Library: Set
Category: Set
Documented under: Members

Clone this wiki locally