fork(4) download
  1. #include <iostream>
  2.  
  3. // length specified implementation
  4. void f(const char *s, std::size_t N)
  5. {
  6. std::cout << "size: " << N << '\n';
  7. }
  8.  
  9. // fixed buffer template wrapper
  10. template<std::size_t N>
  11. void f(const char(&ar)[N])
  12. {
  13. f(ar,N); // invokes length-specified implementation from above.
  14. }
  15.  
  16. int main()
  17. {
  18. f("aaaa");
  19. }
  20.  
Success #stdin #stdout 0s 4428KB
stdin
Standard input is empty
stdout
size: 5