Remove exception throwing from hot path in dispatch
Eliminate fail_cast and stop_iteration exceptions, replacing their use with bool success codes and fold expressions.
This change switches to the non-throwing API of
boost::any_cast, and uses return codes to signal the success of a cast attempt or a group of cast attempts. The short-circuiting fold operators
|| are used to terminate type test loops early and avoid extra work.
These changes resulted in a roughly 60% reduction in runtime for my implicit
astar_search maze routing benchmark.