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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -