title: std::ifstream, use of deleted function
body: <p>I am trying to write a method which will get data from a <code>.txt</code> file.</p>
  
  <p>I need to call this method from other methods. I have a problem with
  passing arguments to methods.</p>
  
  <p>Library.h:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  
  class Library
  {
     std::vector&lt;std::string&gt; &amp;mBooks;
     std::string books_list;
     std::string output;
     std::string books_path;
  
     void read_file(std::string &amp;fn, std::ifstream &amp;fn_var, std::string 
          &amp;s, std::vector&lt;std::string&gt; &amp;vn);
     void create_books_database(std::string &amp;fn, std::ifstream,&amp;fn_var,
          std::string &amp;s, std::vector&lt;std::string&gt; &amp;vn);
  };
  </code></pre>
  
  <p>Library.cpp:</p>
  
  <pre><code>void Library::read_file(std::string &amp;fn, std::ifstream &amp;fn_var, 
  std::string &amp;s, std::vector&lt;std::string&gt; &amp;vn)
  { 
      std::string &amp;filename = fn;
      std::ifstream &amp;name = fn_var;
      std::string &amp;output = s;
      std::vector&lt;std::string&gt; &amp;vector_name = vn;
  
      name.open(filename);
  
      if(!name)
      {
          std::cerr&lt;&lt;"Failed to open file "&lt;&lt;filename&lt;&lt;std::endl;
          exit(1);
      }
  
      while(!name.eof())
      {
          std::getline(name, output);
          vector_name.push_back(output);
      }
  }
  
  void Library::create_books_database(std::string &amp;fn, std::ifstream 
    &amp;fn_var, std::string &amp;s, std::vector&lt;std::string&gt; &amp;vn)
  {
      std::string books_path = fn;
      std::ifstream books_list = fn_var;
      std::string output = s;
      std::vector&lt;std::string&gt; mBooks = vn;
  
      read_file(books_path, books_list, output, mBooks);
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>src/Library.cpp: In member function ‘void                     
  Library::create_books_database(std::__cxx11::string&amp;, std::ifstream&amp;, 
  std::__cxx11::string&amp;, std::vector&lt;std::__cxx11::basic_string&lt;char&gt; 
  &gt;&amp;)’:
  src/Library.cpp:35:32: error: use of deleted function 
  ‘std::basic_ifstream&lt;_CharT, _Traits&gt;::basic_ifstream(const 
  std::basic_ifstream&lt;_CharT, _Traits&gt;&amp;) [with _CharT = char; _Traits = 
  std::char_traits&lt;char&gt;]’
   std::ifstream books_list = fn_var;
  </code></pre>
  
  <p>I think I messed a bit with references.</p>