Template Function ctql::foreach_indexed

Function Documentation

template<class ...Ts, class Fn>
constexpr void ctql::foreach_indexed(Fn &&fn)

Invoke fn.template operator()<T, I>() for each T in Ts... with its zero-based index I.

@usage

struct printer {
  template<class T, std::size_t I>
  void operator()() const {
    // use T and I
  }
};
ctql::foreach_indexed<int, double, char>(printer{});

Template Parameters:

Ts – The type sequence to enumerate.

Parameters:

fn – A callable whose operator() is a template taking <T, I>.