fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. namespace A
  5. {
  6. enum class Indices
  7. {
  8. One,
  9. Two,
  10. Three
  11. };
  12. static std::vector<int> list{6,7,8,9,0};
  13. int pickFromList(Indices i)
  14. {
  15. return list.at(static_cast<int>(i));
  16. }
  17. }
  18.  
  19. namespace B
  20. {
  21. enum class Indices
  22. {
  23. One,
  24. Two,
  25. Three
  26. };
  27. static std::vector<int> list{1,2,3,4,5};
  28. int pickFromList(Indices i)
  29. {
  30. return list.at(static_cast<int>(i));
  31. }
  32. }
  33.  
  34. int main() {
  35. std::cout << pickFromList(B::Indices::One)
  36. << "\t"
  37. << pickFromList(A::Indices::One) << std::endl;
  38. return 0;
  39. }
Success #stdin #stdout 0s 4328KB
stdin
Standard input is empty
stdout
1	6