Guest User

Untitled

a guest
Sep 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. template <typename ... Functions>
  2. struct function_array : public Functions ... {
  3.  
  4. template <std::size_t Index>
  5. using at = std::tuple_element_t<Index, std::tuple<Functions ...>>;
  6.  
  7. template <std::size_t Index, typename ... Args>
  8. constexpr decltype(auto) call(Args&& ... args) const
  9. noexcept(noexcept(std::declval<function_array>().at<Index>::operator()(std::declval<Args>() ...))) {
  10. return at<Index>::operator()(std::forward<Args>(args) ...);
  11. }
  12.  
  13. };
  14. template <typename ... Functions> function_array(Functions ...) -> function_array<Functions ...>;
Add Comment
Please, Sign In to add comment