aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/pile.h
diff options
context:
space:
mode:
authorCharlie Blake2018-01-30 19:51:38 +0000
committerGitHub2018-01-30 19:51:38 +0000
commit2fc005bdbb4707810ad0ae36a6863e70f0ff91b5 (patch)
tree59ca3063ffe6a876d27c96ea95d6a3683273675a /src/main/game/pile.h
parentMerge pull request #31 from thecharlesblake/profiling-fix (diff)
parentAdd ORDER_ON_CACHE to benchmark script (diff)
downloadmetasol-2fc005bdbb4707810ad0ae36a6863e70f0ff91b5.tar.gz
metasol-2fc005bdbb4707810ad0ae36a6863e70f0ff91b5.zip

Merge pull request #32 from thecharlesblake/piles-always-sorted

Piles always sorted

Diffstat (limited to 'src/main/game/pile.h')
-rw-r--r--src/main/game/pile.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/game/pile.h b/src/main/game/pile.h
index 411f890..4256b02 100644
--- a/src/main/game/pile.h
+++ b/src/main/game/pile.h
@@ -12,6 +12,8 @@
#include "card.h"
class pile {
+ friend class hasher;
+ friend class game_state;
public:
typedef uint8_t size_type;
@@ -24,17 +26,20 @@ public:
bool empty() const;
size_type size() const;
- // Modify
- void place(card);
- card take();
-
// Indexes the vector, with the top card as index 0
card& operator[] (size_type);
card operator[] (size_type) const;
friend bool operator==(const pile&, const pile&);
- friend std::size_t hash_value(pile const&);
+ friend bool operator<(const pile&, const pile&);
+ friend bool operator>(const pile&, const pile&);
+ friend bool operator<=(const pile&, const pile&);
+ friend bool operator>=(const pile&, const pile&);
private:
+ // Modify
+ void place(card);
+ card take();
+
// Underlying vector
std::vector<card> pile_vec;
};