Dear,
I am looking for a bidirectional map i.e http://en.wikipedia.org/wiki/Bidirectional_map

My seach into D documentation seem to said to me that this structure is not implemented.

Something like (for primary idea):


struct BidirectionalMap(T,U){
    private:
        T[U] _forwardHash;
        U[T] _reverseHash;

    public:

        @safe
        void opIndeyAssign( T k, U v){ // pure?
            _forwardHash[k] = v;
            _reverseHash[v] = k;
        }


        @property
        BidirectionalMap!(T,U) dup(){
            return BidirectionalMap!(T,U)( this );
        }
}

Reply via email to