| 86 | |
| 87 | template<typename... Args> |
| 88 | void print(auto fmt, const Args&... ts) |
| 89 | { |
| 90 | // #1 Use the count of arguments and compare it to the size |
| 91 | // of the pack |
| 92 | static_assert(fmt.numArgs == sizeof...(Args)); |
| 93 | |
| 94 | // cannot pass ts... because that is run-time |
| 95 | static_assert( |
| 96 | IsMatching<std::decay_t<decltype(fmt.fmt.data[0])>, |
| 97 | Args...>(fmt.fmt.data)); |
| 98 | |
| 99 | printf(fmt, ts...); |
| 100 | } |
| 101 | |
| 102 | void print(char* s, const auto&... ts) |
| 103 | { |