View source code
					
 Display the source code in std/variant.d from which this page was generated on
 github.
					
				
				
 Improve this page
					
 Quickly fork, edit online, and submit a pull request for this page.
 Requires a signed-in GitHub account. This works well for small changes.
 If you'd like to make larger changes you may want to consider using
 local clone.
					
				
				
 Page wiki
					
 View or edit the community-maintained wiki page associated with this page.
					
				
			
			Template std.variant.VariantN.opIndex
			 Array and associative array operations. If a VariantN
Arguments
template opIndex(K);
Functions
| Function name | Description | 
|---|---|
| opIndex | 
Example
auto a = Variant(new int[10]); a[5] = 42; assert(a[5] == 42); int[int] hash = [ 42:24 ]; a = hash; assert(a[42] == 24);
Example
Caveat
    Due to limitations in current language, read-modify-write
    operations op= will not work properly:
Variant a = new int[10]; a[5] = 42; a[5] += 8; //assert(a[5] == 50); // will fail, a[5] is still 42