more restricted Functor::rtype, remove with_output_tree, adapt Monitor.h
This MR significantly simplifies rtype()
which returns information about the return type of a (prepared) functor.
It no longer tries to figure out the actual return type, but returns the return type of the wrapper -- this significantly simplifies the work the compiler must do, and thus reduces the memory footprint and CPU time required to compile functors. It also implies that code that uses functors which are explicitly requested to return std::any
will now get an rtype()
corresponding to the std::any
and no longer of the underlying payload of the std::any
.
This affects the with_output_tree
mix-in which pushes functor results into a Tree, and which books the needed branches prior to invoking any functor, and thus now runs into a type for which it fails to book a branch. However, as with_output_tree
is only used in a single set of algorithms which are not in actual use, this functionality is removed (see Moore!3680 (merged)).
Note that DaVinci also uses functors which are explicitly requested to return std::any
but it does not rely on rtype()
to determine the underlying type -- instead it waits until it receives an std::any
, and then dynamically dispatches based on the payload of the std::any
, and it books the corresponding branch 'on demand' (i.e. when it is first filled).
In addition, the with_output_tree
infrastructure is also used by a (very generic) monitoring algorithm to fill a histogram, but there the situation is easier: one just needs to (dynamically) turn the std::any
in one of a very small set of types which can subsequently be used decide which bin to increment. This is a subset of the functionality in FunTuple
, and this has been solved in the same way (dynamic dispatch based on std::any::type()
).
As this removes with_output_tree
, it must go together with Moore!3680 (merged) which removes the uses of it.