Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3662

Show
Ignore:
Timestamp:
06/22/08 21:46:44 (3 months ago)
Author:
kris
Message:

added opIndexAssign()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/util/container/more/Vector.d

    r3657 r3662  
    3131 
    3232        alias slice             opSlice; 
    33         alias nth               opIndex; 
    3433           
    3534        /*********************************************************************** 
     
    141140        /********************************************************************** 
    142141 
    143                 Index vector entries, where a zero index represents the 
    144                 oldest vector entry (the top). 
     142                Index vector entries, as though it were an array 
    145143 
    146144                Throws an exception when the given index is out of range 
     
    148146        **********************************************************************/ 
    149147 
    150         V nth (uint i) 
     148        V opIndex (uint i) 
    151149        { 
    152150                if (i < depth) 
    153151                    return vector [i]; 
     152 
     153                return error (__LINE__); 
     154        } 
     155 
     156        /********************************************************************** 
     157 
     158                Assign vector entries as though it were an array. 
     159 
     160                Throws an exception when the given index is out of range 
     161 
     162        **********************************************************************/ 
     163 
     164        V opIndexAssign (V value, uint i) 
     165        { 
     166                if (i < depth) 
     167                   { 
     168                   vector[i] = value; 
     169                   return value; 
     170                   } 
    154171 
    155172                return error (__LINE__);