For an abstract description, that was pretty clear.
Time for some nuts and bolts!
Let's use an STL vector for this.
The rank would simply use the [] operator.
The sequence ( left or right ) would take an iterator and return an iterator for the member on the left or right, or end() if there is none. Something like this:
-
typedef vector < T >::iterator P;
-
vector < T > mySequence;
-
-
P left( P p ) { if( p == mySequence.begin() ) return mySequence.end(); else return p - 1; }
-