fork download
  1. #include <string>
  2. #include <vector>
  3. #include <iostream>
  4. #include <initializer_list>
  5.  
  6. struct Deck
  7. {
  8. Deck(std::initializer_list<std::string> init_list) : _deck(init_list.begin(), init_list.end()) {}
  9.  
  10. const std::vector<std::string>& get() const { return _deck; }
  11. private:
  12. std::vector<std::string> _deck;
  13. };
  14.  
  15. int main()
  16. {
  17. Deck d({ "rock", "paper", "scissors" });
  18.  
  19. for (auto card : d.get())
  20. std::cout << card << '\n';
  21. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
rock
paper
scissors