I have read "Modern C++ Design"
and I have a question in its sample code
in p278 p279
or refer to Loki's source if you don't have the book
BasicDipatcher::Add and BasicDispatcher::Go in MutilMethods.h
in page p278 bottom to p279 up
it has a piece of sample code
typedef BasicDispatcher<Shape> Dispatcher;
void HatchRectanglePoly(Shape& lhs, Shape& rhs) {...}
Dispatcher disp;
disp.Add<Rectangle, Poly>(HatchRectanglePoly);
I found in function Go, its arguments are BaseLhs&, BaseRhs&
which in this case, should be Shape&, Shape&
and in function Add, its arguments are SomeLhs&, SomeLhs&,
which in this case, should be Rectangle&, Poly&
so the key won't match anyway because they are different
therefore the callback(HatchRectanglePoly) won't be called
(If I add disp.Go.... in the samele code),
and instead,
a std:runtime_error will be thrown
Am i correct??
thanks