Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22155

non-const lvalue reference type _normal_iterator cannot bind a temporary of type _normal iterator in gcc

$
0
0

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(); 

Viewing all articles
Browse latest Browse all 22155

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>