title: Seg Fault resulting from push_back call on vector (threads linux)
body: <p>So what I'm trying to do is write a program that creates a series of child threads that take the arguments using the pthread_create method and uses the parameter passed in to do more manipulation and so on. The parameter I'm trying to pass in is a vector argument called reduce_args_. this is the header information for the struct ReduceVector.</p>
  
  <pre><code>typedef vector&lt;string&gt; StringVector;
  
  // a data structure to maintain info for the reduce task
  struct ReduceArg
  {
    ReduceArg (void);  // constructor
    ~ReduceArg (void); // destructor
  
    pthread_t tid;  // thread id of the reduce thread
    StringVector files_to_reduce; // set of files for reduce task
  };
  
  // more typedefs
  typedef vector&lt;ReduceArg *&gt; ReduceVector;
  </code></pre>
  
  <p>now the issues comes when I call push_back here:</p>
  
  <pre><code>for(int i = 0; i &lt; num_reduce_threads_ ; i++){
              reduce_args_.push_back(phold);
          int count = 0;
          for(ShuffleSet::iterator it = shuffle_set_.begin(); it!=shuffle_set_.end(); ++it){
              string line = *it;
              string space = " ";
              string file = line.substr(0, line.find(space)) + ".txt";
  
              if (count &lt; num_reduce_threads_){
                  cout &lt;&lt; reduce_args_[i+1];
                  (reduce_args_[i+1] -&gt; files_to_reduce)[count] = file;
                              //(reduce_args_[i+1] -&gt; files_to_reduce).push_back(file);
               }
               count++;
              //cout &lt;&lt; ((reduce_args_.back())-&gt;files_to_reduce).back()&lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>both of those push_back methods cause a seg fault. the shuffle set is just a set and is outputting strings. and as noted in the .h file, the files_to_reduce is a string vector. So what I'm trying to do is access the files_to_reduce and push_back a string onto it, but each time I get a seg fault. The reduce_args_ obj is declared as below:</p>
  
  <pre><code>ReduceArg* plhold;
      reduce_args_.push_back(plhold);
      ((reduce_args_.back()) -&gt; files_to_reduce).push_back("hello");
      for (int i = 0; i &lt; this-&gt;num_reduce_threads_; ++i) {
        // create a placeholder reduce argument and store it in our vector
        (reduce_args_.push_back(plhold));
      }
  </code></pre>
  
  <p>thanks for the help!!</p>