Function Enumap.opIndex

Access the value at the index specified by an enum member.

Indexing returns a reference, so it can be used as a getter or setter.

Prototype

inout auto ref opIndex(
  K key
);

Example

Enumap!(Element, int) elements;
elements[Element.fire] = 4;
assert(elements[Element.fire] == 4);

Authors

Ryan Roden-Corrent (rcorre)

Copyright

© 2015, Ryan Roden-Corrent

License

MIT