The example is a bit silly, since foreach discards the return value of
apply_visitor anyway. So my solution was to change the visitor to
define result_type as void. This works. However, I am wondering why
delayed_visitor does no longer work in this situation? Is it because I
am trying to return a reference?