title: Program crash when trying to work on the vector member of a class
body: <p>Hello i tried everything i could think at to repair the crash... but didn't get anywere. So i'll try to paste the main components of the program so maybe someone can help with this... the program compiles has no errors but it crashes.
  If i run the program take first option '1' than enter inputs... when it  gets to <code>save</code> part it just crashes. Some parts of the code are commented out ebcuase i tried to fnd the soruce of the crash. In case i forgott something or you need soem other details please ask
  SORRY for the long code.
  Main function and  Appplication Class:</p>
  
  <pre><code>#include "Catalog.h"
  #include "UIconsole.h"
  #include "StudentRepository.h"
  #include "StudentValidator.h"
  
  
  using namespace std;
  
  class Application{
  private:
      StudentRepository *stre;
      StudentValidator *stvl;
      Catalog *cat;
      UIconsole *ui;    
  public:
      Application();
      ~Application();
      void run();
  };    
  int main(){
      Application app;
      app.run();
      return 0;
  }    
  Application::Application(){
      StudentRepository stre();
      StudentValidator stvl();
      Catalog cat();
      UIconsole ui();
  }    
  Application::~Application(){
  }
  void Application::run(){
      ui-&gt;runUI();
  }
  </code></pre>
  
  <p>UIconsole.h (were inputs are choisen):</p>
  
  <pre><code>class UIconsole{
  public:
      UIconsole(Catalog *catalog):catalog(catalog){};
      void runUI();
  
  private:
      Catalog *catalog;
  
      void showMenu();
      int getOption();
  
      void addStudent();
  </code></pre>
  
  <p>UIconsole.cpp</p>
  
  <pre><code>int inp;
  do{
      showMenu();
      inp = getOption();
      switch(inp){
      case 0: break;
      case 1: addStudent();break;
      }while(inp != 0);
  }
  
  void UIconsole::addStudent(){
      string name;
      int id,gr;
      cout&lt;&lt;"Name: ";
      cin&gt;&gt;name;
      cout&lt;&lt;"ID: ";
      cin&gt;&gt;id; cout&lt;&lt;endl;
      cout&lt;&lt;"Group: ";
      cin&gt;&gt;gr; cout&lt;&lt;endl;
  
      catalog-&gt;addNewStudent(name,id,gr);
  //  try {
  //      catalog-&gt;addNewStudent(n,id,gr);
  //      cout&lt;&lt;"Student has been added!"&lt;&lt;endl;
  //  } catch (Exception &amp;ex) {
  //      cout&lt;&lt;"Student HASN'T been added"&lt;&lt;ex.getMsg()&lt;&lt;endl;
  //  }
  
  }
  </code></pre>
  
  <p>catalog.cpp:</p>
  
  <pre><code>void Catalog::addNewStudent(string name, int id, int gr){
  Student st(name, id,gr);
  //StudentValidator.
  studRepo.save(st);
  </code></pre>
  
  <p>}</p>
  
  <p>studentRepo.cpp:</p>
  
  <pre><code>void StudentRepository::save(Student A){
      string B;
      int check;
      B = A.getName();
  //  check = findByName(B);
  //
  //  if(check != 0){
          students.push_back(Student(A));
  //  }
  //  else{
  //      throw RepoException("Name already exist in the database!");
  //  }
  }
  </code></pre>
  
  <p>studentRepo.h</p>
  
  <pre><code>class StudentRepository{
  private:
      vector &lt;Student&gt; students;
  public:
      vector &lt;Student&gt; getAll();
      void save(Student);
      void edit(Student);
      void delByName(string);
      void searchById();
  
      int findByName(string name);
  
      ~StudentRepository();
  
  };
  </code></pre>
  
  <p>Trace:</p>
  
  <pre><code>    Dr. Memory version 1.4.6 build 2 built on Mar  7 2012 10:14:04
  Application cmdline: ""D:\c++\Begin\L_6-8\Debug\L_6-8.exe""
  Recorded 62 suppression(s) from default C:\Program Files (x86)\Dr. Memory/bin/suppress-default.txt
  
  Error #1: UNINITIALIZED READ: reading register eax
  # 0 _fu36___ZSt4cout                 [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:90]
  # 1 UIconsole::runUI()               [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:19]
  # 2 Application::run()               [D:\c++\Begin\L_6-8\Debug/../App.cpp:43]
  # 3 main                             [D:\c++\Begin\L_6-8\Debug/../App.cpp:27]
  Note: @0:00:10.842 in thread 5436
  Note: instruction: mov    (%eax) -&gt; %eax
  
  Error #2: UNADDRESSABLE ACCESS: reading 0x00000004-0x00000008 4 byte(s)
  # 0 std::vector&lt;&gt;::push_back()               [c:/mingw/bin/../lib/gcc/mingw32/4.6.1/include/c++/bits/stl_vector.h:828]
  # 1 StudentRepository::save()                [D:\c++\Begin\L_6-8\Debug/../StudentRepository.cpp:27]
  # 2 Catalog::addNewStudent()                 [D:\c++\Begin\L_6-8\Debug/../Catalog.cpp:7]
  # 3 _fu36___ZSt4cout                         [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:90]
  # 4 UIconsole::runUI()                       [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:19]
  # 5 Application::run()                       [D:\c++\Begin\L_6-8\Debug/../App.cpp:43]
  # 6 main                                     [D:\c++\Begin\L_6-8\Debug/../App.cpp:27]
  Note: @0:00:10.853 in thread 5436
  Note: instruction: mov    0x04(%eax) -&gt; %edx
  
  Error #3: LEAK 21 direct bytes 0x006ff488-0x006ff49d + 0 indirect bytes
  # 0 libstdc++-6.dll!Znwj           
  # 1 libstdc++-6.dll!ZNSs7reserveEj 
  # 2 libstdc++-6.dll!ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RSbIS4_S5_T1_E
  # 3 _fu2___ZSt3cin                                                             [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:81]
  # 4 UIconsole::runUI()                                                         [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:19]
  # 5 Application::run()                                                         [D:\c++\Begin\L_6-8\Debug/../App.cpp:43]
  # 6 main                                                                       [D:\c++\Begin\L_6-8\Debug/../App.cpp:27]
  
  DUPLICATE ERROR COUNTS:
  
  SUPPRESSIONS USED:
  
  ERRORS FOUND:
        1 unique,     1 total unaddressable access(es)
        1 unique,     1 total uninitialized access(es)
        0 unique,     0 total invalid heap argument(s)
        0 unique,     0 total warning(s)
        1 unique,     1 total,     21 byte(s) of leak(s)
        0 unique,     0 total,      0 byte(s) of possible leak(s)
  ERRORS IGNORED:
       84 still-reachable allocation(s)
           (re-run with "-show_reachable" for details)
  Details: C:\Users\Warzaru\AppData\Roaming/Dr. Memory/DrMemory-L_6-8.exe.8092.000/results.txt
  </code></pre>