fork download
  1. #include <iostream>
  2.  
  3. struct A {
  4. static const int bar = 42;
  5. };
  6.  
  7. void foo(const int x) { // does not work with (const int&)
  8. std::cout << x << std::endl;
  9. }
  10.  
  11. template<int val>
  12. struct plusOne {
  13. enum {value = val+1};
  14. };
  15.  
  16.  
  17. int main() {
  18. foo(A::bar);
  19. std::cout << plusOne<A::bar>::value << std::endl;
  20. return 0;
  21. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
42
43