6.2 containers.Map
- m = containers.Map ()
- m = containers.Map (keys, vals)
- m = containers.Map (keys, vals, "UniformValues", is_uniform)
- m = containers.Map ("KeyType", kt, "ValueType", vt)
-
Создать объект класса containers.Map, который хранит список пар ключ/значение.
keys — массив уникальных ключей для карты. Ключи могут быть числовыми скалярами или строками. Тип числовых ключей может быть одним из
"double","single","int32","uint32","int64", или"uint64". Другие числовые или логические ключи будут преобразованы в"double". Одна строка-ключ может быть введена как есть. Несколько строковых ключей вводятся как ячейный массив строк.vals — массив значений для карты с тем же количеством элементов, что и у keys.
При вызове без входных аргументов создается карта по умолчанию со строками в качестве типа ключа и
"any"в качестве типа значения.Опция
"UniformValues"указывает, должны ли значения карты строго иметь один и тот же тип. Если is_uniform истинно, любые значения, которые будут добавлены в карту, сначала проверяются на соответствие нужному типу.При вызове с аргументами
"KeyType"и"ValueType"создается пустая карта с указанными типами. Входные данные kt и vt — типы ключей и значений карты соответственно. Допустимые значения для kt —"char","double","single","int32","uint32","int64","uint64". Допустимые значения для vt —"any","char","double","single","int32","uint32","int64","uint64","logical".Возвращаемое значение m — объект класса containers.Map.
См. также: struct.
© 1996–2022 The Octave Project Developers
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://docs.octave.org/v5.2.0/containers_002eMap.html