In the last line of the below code I get an error:
non-const lvalue reference type _normal_iterator<> cannot bind a temporary of type _normal iterator
with gcc, but not with Visual studio. Any suggestions why are highly appreciated.
struct Hand {
Hand() = default;
explicit Hand(std::set<std::string> cards) : cards(std::move(cards)) {}
auto begin() const { return cards.begin(); }
auto end() const { return cards.end(); }
};
std::vector<Hand> player_hands(number_players); // empty container
auto &hand_it = player_hands.begin();