text: first_of¶
  Description¶
  The
  first_of,
  first_of will call the first function
  that is callable, regardless if there is another function that could be
  called as well.
  Requirements¶
  Fs must be:
  - ConstInvocable
  - MoveConstructible
  Example¶
  #include <boost/hof.hpp> #include <iostream> using namespace boost::hof; struct for_ints { void operator()(int) const { printf("Int\n"); } }; struct for_floats { void operator()(float) const { printf("Float\n"); } }; int main() { first_of(for_ints(), for_floats())(3.0); }
  This will print
  Int because the
  for_floats function object won’t ever be
  called. Due to the conversion rules in C++, the
  for_ints function can be
  called on floats, so it is chosen by
  first_of first, even though
  for_floats is a better match.
  So, the order of the functions in the
  first_of_adaptor are very important
  to how the function is chosen.
  References¶
  - POO51 - Proposal for C++ Proposal for C++ generic overload function
  - Conditional overloading