fork download
  1. #include <iostream>
  2.  
  3. template<typename T, size_t Length>
  4. size_t f(const T (&)[Length]) {
  5. return Length;
  6. }
  7.  
  8. template<typename T, size_t Length, typename... Args>
  9. size_t f(const T (&)[Length], Args... rest) {
  10. return Length + f(rest...);
  11. }
  12.  
  13. int main() {
  14. int a[] = { 1, 2, 3 }, b[] = { 1, 2, 3, 4, 5 }, c[] = { 1 };
  15.  
  16. std::cout << f(a, b, c);
  17. }
  18.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'size_t f(const T (&)[Length], Args ...) [with T = int, unsigned int Length = 3u, Args = {int*, int*}, size_t = unsigned int]':
prog.cpp:16:27:   instantiated from here
prog.cpp:10:30: error: no matching function for call to 'f(int*&, int*&)'
stdout
Standard output is empty