fork download
  1. #include <iostream>
  2. #include <array>
  3.  
  4. struct Foo {
  5. int i;
  6. static const std::array<Foo, 2> A;
  7. };
  8.  
  9. constexpr std::array<Foo, 2> Foo::A {{{1}, {2}}};
  10.  
  11. template<int N>
  12. int foo() { return N; }
  13.  
  14. int main(int, char**)
  15. {
  16. std::cout << "Foo::A[0]: " << foo<Foo::A[0U].i>() << "\n"
  17. << "Foo::A[1]: " << foo<Foo::A[1U].i>();
  18. return 0;
  19. }
Success #stdin #stdout 0s 4292KB
stdin
Standard input is empty
stdout
Foo::A[0]: 1
Foo::A[1]: 2