title: segmentation fault when string have 16 or more elements
body: <p>I encountered a strange problem. I developing a genetic algorithm.</p>
  
  <p>I have a class named <code>IndividuoBinario</code> with private <code>string cromossomo;</code> in construtor of this class put <code>this-&gt;cromossomo = "1111111111111111";</code> with 16 elements, when call a this class like <code>IndividuoBinario newIndividuo;</code> work fine, BUT when i call with fuction pair like <code>pair&lt;IndividuoBinario, IndividuoBinario&gt; newIndividuosCrossover;</code> happen a segmentation fault. But the strange thing is that when i put <code>this-&gt;cromossomo = "111111111111111";</code> with less then 16 elements work fine.</p>
  
  <p>Resume: when call a class by fuction pair and put more then 16 elements in string happen a segmentation fault.</p>
  
  <p>Some important codes:</p>
  
  <pre><code>void main() {
     PopulacaoBinario pop;
     pop = pop.rollet();
  }
  
  const PopulacaoBinario PopulacaoBinario::rollet() {
        static mt19937 mt(time(NULL));
        pair&lt;IndividuoBinario, IndividuoBinario&gt; newIndivuos;
        static PopulacaoBinario newPop;
        newPop.populacao.clear();
        int var, valorDaRollet = 0, individuoParaCross[1] { 0 }, auxInsertIndv = 0;
        double valorTotalFitness = 0.0, valorAcumuladoFitness = 0.0;
  
  for (var = 0; var &lt; this-&gt;qtdIndividuos; ++var) {
      if (this-&gt;fitnessEscalonado)
          valorTotalFitness += calculoFitnessEscalonado(this-&gt;populacao[var].getFitness());
      else
          valorTotalFitness += this-&gt;populacao[var].getFitness();
  }
  
  for (int loopNovosIndiv = 0; loopNovosIndiv &lt; (this-&gt;qtdIndividuos * this-&gt;gap) / 2;
          ++loopNovosIndiv) {
      for (int loop = 0; loop &lt; 2; ++loop) {
          static uniform_int_distribution&lt;int&gt; numeroRandom(0, 100);
  
          valorDaRollet = numeroRandom(mt);
  
          for (var = 0; var &lt; this-&gt;qtdIndividuos - 1; ++var) {
              if (this-&gt;fitnessEscalonado)
                  valorAcumuladoFitness += ((double) calculoFitnessEscalonado(
                          this-&gt;populacao[var].getFitness()) / valorTotalFitness) * 100;
              else
                  valorAcumuladoFitness += ((double) this-&gt;populacao[var].getFitness()
                          / valorTotalFitness) * 100;
  
              if (valorDaRollet &lt; valorAcumuladoFitness)
                  break;
          }
          valorAcumuladoFitness = 0;
          individuoParaCross[loop] = var;
      }
      newIndivuos = crossoverUniforme(individuoParaCross[0], individuoParaCross[1]);
      newPop.insertIndividuo(newIndivuos.first);
      newPop.insertIndividuo(newIndivuos.second);
  }
  
  for (int count = newPop.getQtdIndividuos(); count &lt; this-&gt;qtdIndividuos; ++count)
      newPop.insertIndividuo(this-&gt;populacao[count]);
  
  return newPop;
  }
  
  
  const pair&lt;IndividuoBinario, IndividuoBinario&gt; PopulacaoBinario::crossoverUniforme(int individuo1,
          int individuo2) {
      static mt19937 mt(time(NULL));
      static uniform_int_distribution&lt;int&gt; bit(1, 99);
      int var, a = bit(mt);
  
      int qtdBits = this-&gt;populacao[individuo1].getCromossomo().size();
      cout &lt;&lt; "Before pair" &lt;&lt; endl;
      pair&lt;IndividuoBinario, IndividuoBinario&gt; newIndividuosCrossover;
      cout &lt;&lt; "not enough in this line" &lt;&lt; endl;
      IndividuoBinario newIndividuo1 = this-&gt;populacao[individuo1];
      IndividuoBinario newIndividuo2 = this-&gt;populacao[individuo2];
  
      if (this-&gt;chanceCrossover &gt; a) {
          string cromossomoNewInviduio1 = this-&gt;populacao[individuo1].getCromossomo();
          string cromossomoNewInviduio2 = this-&gt;populacao[individuo2].getCromossomo();
          for (int var = 0; var &lt; this-&gt;populacao[individuo1].getCromossomo().size(); ++var) {
              static uniform_int_distribution&lt;int&gt; numRandon(0, 1);
              a = numRandon(mt);
              if (a == 1) {
                  cromossomoNewInviduio1[var] = this-&gt;populacao[individuo2].getCromossomo()[var];
                  cromossomoNewInviduio2[var] = this-&gt;populacao[individuo1].getCromossomo()[var];
              }
          }
          newIndividuo1.setCromossomo(cromossomoNewInviduio1);
          newIndividuo2.setCromossomo(cromossomoNewInviduio2);
      }
      newIndividuosCrossover = make_pair(newIndividuo1, newIndividuo2);
      return newIndividuosCrossover;
  }
  
  IndividuoBinario::IndividuoBinario() {
       this-&gt;cromossomo = "1111111111111111"; //segmentation fault 
       this-&gt;cromossomo = "111111111111111"; //normal
       cout &lt;&lt; this-&gt;cromossomo &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Sorry by the bad english.</p>