Skip to content

Make functors std::visit variants instead of std::invoking them

Olli Lupton requested to merge olupton_no_zip_same into master

This makes the new/ThOr functors natively handle std::variant<Ts...> types.

This support is injected at the highest level, namely the Functor<Out(Inputs...)> wrapper. If the Inputs... types are all std::variant<Ts...> types then the contained functor will be called using std::visit, otherwise it is called with std::invoke (as before). std::visit has a small runtime overhead, but because this support is injected at the highest level then this should be minimised.


  • Fix documentation in Filter.h
  • Add the optional name() function to the nHits functor to improve debug messages
  • Add examples/tests of the std::variant support described above.
  • Add test of the new zip.get<T>() accessor added in LHCb!2198 (merged)
  • Add test of the new make_zip( a, b ) == make_zip( b, a ) feature added in LHCb!2198 (merged)

Goes with LHCb!2198 (merged).

Edited by Olli Lupton

Merge request reports