title: error when erasing object in vector. how do i add move assignment operators to my classes?
body: <p>I am getting an error when I am trying to erase an object from my vector</p>
  
  <p>googled but I can't understand what's wrong. from what I gathered I am calling the erase function correctly but I have to provide a move assignment operator to my classes?</p>
  
  <p>my function where i call the erase</p>
  
  <pre><code>void removegroup(const short &amp;group){
  switch (tracker[group].group){
      case 0: {
          guardvec.erase(guardvec.begin()+tracker[group].position); //this is the problem it compiles just fine if i comment out this line
          //guardvec.erase(remove(guardvec.begin(), guardvec.end(), tracker[group].position),guardvec.end()); //tried this and it doesnt work
      }
  
          break;
  }
  for (short counter=0;counter&lt;tracker.size();counter++)
      if ((tracker[counter].group==tracker[group].group)&amp;&amp;(tracker[counter].position&gt;tracker[group].position))
          tracker[counter].position=tracker[counter].position--;
  }
  </code></pre>
  
  <p>my class</p>
  
  <pre><code>class guardhitdice {
      friend class guard;
      short const times = 2, dice = 8, plus = 2;
  };
  
  class guard : private guardhitdice {
  private:
      short units, XP, morale, totalHP=0, dead=0, wounded=0;
      short* HP = new short[units];
  public:
      void showstats(){
          std::cout &lt;&lt; "STR=1, DEX=1, CON=1, INT=0, WIS=0, CHA=0, Perception=2, Passive Perception=12"&lt;&lt;std::endl
          &lt;&lt;"current xp: "&lt;&lt;XP&lt;&lt;"total HP across units: "&lt;&lt;totalHP&lt;&lt;"casualties: "&lt;&lt;dead&lt;&lt;"wounded: "&lt;&lt;wounded;
      }
      void initializeHP(){
          for (short counter=0; counter&lt;units-1; counter++){
              HP[counter]=plus + D(times, dice);
              totalHP+=HP[counter];
          }
      }
     guard(const short &amp;xp, short &amp;Units, short &amp;Morale){
         XP=xp;
         units=Units;
         morale=Morale;
        // short* HP = new short[units];
         initializeHP();
     }
      ~guard(){
          delete HP;
      }
  
  };
  </code></pre>
  
  <p>here is my compiler error <a href="https://pastebin.com/KSniFkVD" rel="nofollow noreferrer">https://pastebin.com/KSniFkVD</a>
  it should be able to remove the object at tracker[group].position. btw position is a short
  i also tried adding this to my classes but they don't work</p>
  
  <pre><code>guardhitdice&amp; guardhitdice ::operator=(guardhitdice&amp;&amp;);
  </code></pre>
  
  <pre><code>  guard&amp; guard ::operator=(guard&amp;&amp;);
  </code></pre>
  
  <p>it works if I do it for normal vectors but not for vectors of objects</p>