c++ - Passing a vector of specific size to a function -
/* class hand represents hand in hold'em poker. namely best 5 cards formed 7 cards: 2 player's pocket cards , 5 cards board.*/ class hand { public: hand(const std::vector<cardptr>& cardseq); /*...*/ };
constructor expects vector of cards. internal logic of class based on assumption given vector consists of 7 cards. i'm not controlling it. can throw exception when cardseq.size() != 7
in constructor. there other way of keeping behaviour of instance of class meaningful controlling size of initializing vector?
if data structure array of 7 cards, why not use std::array<cardptr, 7>
?
Comments
Post a Comment