From 1f078952baf3cc8512b709e345a622add91a667b Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 18 Jan 2018 13:49:10 +0000 Subject: Add vector and initializer lst constructor to pile --- src/main/game/pile.cpp | 6 +++++- src/main/game/pile.h | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/game/pile.cpp b/src/main/game/pile.cpp index ba7c1b9..21eddc0 100644 --- a/src/main/game/pile.cpp +++ b/src/main/game/pile.cpp @@ -9,7 +9,11 @@ using namespace std; -pile::pile(std::vector pv) : pile_vec(pv) {} +pile::pile(std::vector pv) : pile_vec(pv) { +} + +pile::pile(std::initializer_list il) : pile_vec(il) { +} card pile::top_card() const { assert(!empty()); diff --git a/src/main/game/pile.h b/src/main/game/pile.h index fb7bc38..411f890 100644 --- a/src/main/game/pile.h +++ b/src/main/game/pile.h @@ -13,9 +13,12 @@ class pile { public: - pile(std::vector); typedef uint8_t size_type; + pile() = default; + pile(std::vector); + pile(std::initializer_list); + // Inspect card top_card() const; bool empty() const; -- cgit v1.2.1