aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorthecharlesblake2018-01-18 13:49:10 +0000
committerthecharlesblake2018-01-18 13:49:10 +0000
commit1f078952baf3cc8512b709e345a622add91a667b (patch)
tree9f3f3ec6508cb2a4babde747e85b43594a748221 /src
parentUpdate parsing to check correct features (diff)
downloadmetasol-1f078952baf3cc8512b709e345a622add91a667b.tar.gz
metasol-1f078952baf3cc8512b709e345a622add91a667b.zip

Add vector and initializer lst constructor to pile

Diffstat (limited to 'src')
-rw-r--r--src/main/game/pile.cpp6
-rw-r--r--src/main/game/pile.h5
2 files changed, 9 insertions, 2 deletions
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<card> pv) : pile_vec(pv) {}
+pile::pile(std::vector<card> pv) : pile_vec(pv) {
+}
+
+pile::pile(std::initializer_list<card> 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<card>);
typedef uint8_t size_type;
+ pile() = default;
+ pile(std::vector<card>);
+ pile(std::initializer_list<card>);
+
// Inspect
card top_card() const;
bool empty() const;