The OpenD Programming Language

keys

Returns a newly allocated dynamic array containing a copy of the keys from the associative array.

  1. Key[] keys(T aa)
  2. Key[] keys(T* aa)
    @property
    Key[]
    keys
    (
    T : Value[Key]
    Value
    Key
    )
    (
    T* aa
    )

Parameters

aa T*

The associative array.

Return Value

Type: Key[]

A dynamic array containing a copy of the keys.

Examples

auto aa = [1: "v1", 2: "v2"];
int sum;
foreach (k; aa.keys)
    sum += k;

assert(sum == 3);

Meta