Double-dispatch

Sean Eskapp eatingstaples at gmail.com
Sun Feb 13 10:57:33 PST 2011


I remember in C++, I had to do double-dispatch using the visitor pattern. This
is cumbersome, just because each subclass has to have the exact same
singly-dispatched code that looks like:

void dispatch(Base& other)
{
   other.dispatch(*this);
}

Is there a nicer way to do this in D, or am I stuck with the same thing?


More information about the Digitalmars-d-learn mailing list