![]() |
Qore Programming Language Reference Manual
1.10.0
|
The hashdecl keyword allows for type-safe hashes to be declared; they can then be instantiated with the new operator, the cast<> operator, or with variable implicit construction.
hashdecl hashdecl_identifier {
member_type member_name [= initialization_expression];
[...]
}
At least one member must be defined; it's not possible to declare an empty type-safe hash.
hashdecl may not have the name "auto", this name has a special meaning in complex typesWhen type-safe hashes are created, the hash is automatically populated with the values given by the initialization expressions in the hashdecl declaration (if any).
It is possible to override these declarations by passing a hash to be used for initialization; this can be passed the single optional argument to the type-safe hash initialization as in the following examples: