I'm making blackjack and I'm trying to erase cards from the deck vector after dealing them, there is an error for every single instance of the .erase function. Im a beginner so sorry if this is something trivial.
#include <bits/stdc++.h>
#include <random>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <vector>
int main() {
  
  std::vector<int>deck {2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11}; 
   std::random_device rd;
    std::mt19937 g(rd());
  std::shuffle(deck.begin(), deck.end(), g);
  //creates 2 decks and shuffles them
  int dealervalue = deck[0];
  deck.erase(0);  
  int yourvalue = deck[0] + deck[1];
  deck.erase(0);
  deck.erase(0);  
  std::cout << dealervalue << "\n" << yourvalue;
  //deals cards
return 0;
 }
 
    