filling a vector of pointers to vectors
===

I have a vector of pointers to vectors:

    main(...)
    {
      //...
      std::vector< std::vector<double> * > ds = getDS(...)
      //...
    }

    std::vector<std::vector<double> * > getDS(int m, ...)
    {
      std::vector<std::vector<double> * > wavefunctions = *(new std::vector<std::vector<double>*>(m));
      int n = int( params.rmax() / params.dr() );
      std::ifstream input_wf;
      input_wf.open(filename.c_str());
      input_wf.setf(std::ios::showpoint | std::ios::scientific);
      for(int i=0; i < nbasis; i++)
      {
        std::vector<double> *wf = new std::vector<double>(n);
        //(wavefunctions[i]) = new std::vector<double>(n);
        for (unsigned int ir=0; ir < wf->size(); ir++)
          input_wf >> ( *wf )[ir];
        wavefunctions.push_back(wf);
      }
      input_wf.close();
      return wave functions;
    }
    

However, I keep getting a EXC_BAD_ACCESS error when I try to access `wavefunctions[0]->at(some legal value)` after going through the loop once, during debugging.  (There *should* be something there, but I'm not sure why there isn't...  Any ideas?

