vector length_error

Reserve Length error’ STD ::length_error’ What (): Vector ::_M_fill_insert
The reason is that the reserved length (resize() parameter of the vector function) is incorrect.
Such as:
Examples in the c++ reference documentation.

// length_error example
#include <iostream>       // std::cerr
#include <stdexcept>      // std::length_error
#include <vector>         // std::vector

int main (void) {
  try {
    // vector throws a length_error if resized above max_size
    std::vector<int> myvector;
    myvector.resize(myvector.max_size()+1);
  }
  catch (const std::length_error& le) {
	  std::cerr << "Length error: " << le.what() << '\n';
  }
  return 0;
}

is resize assigns the maximum length +1,
there are V.r esize (n.) not sure, but n (code appear the error, not for n assignment, all can sometimes run, sometimes when n is negative)
references: cplusplus.com/reference/stdexcept/length_error/

 

Read More: