0
/* Class Hand represents a hand in Hold'em poker.
Namely the best 5 cards formed from 7 cards: 2 player's pocket cards
and 5 cards from the board.*/
class Hand {
public:
Hand(const std::vector<CardPtr>& cardseq);
/*...*/
};
構造函數需要一張卡片向量。該類的內部邏輯是基於給定矢量由7個卡組成的假設。但我沒有控制它。當構造函數中的cardseq.size() != 7
可以引發異常。但有沒有其他方法通過控制初始化向量的大小來保持類實例的行爲?將特定大小的矢量傳遞給函數
你必須使用矢量嗎? – Dannnno
使用7個輸入參數或傳入數組可能會更好。 – phantom
'在構造函數中投擲'給了我一個寒意...... –