title: c++ passing std::function with custom object as argument in threading
body: <p>I have an seperate class to handle threading, and there is a function need to create a thread and repeat the function for a specific interval</p>
  
  <pre><code>void timer_start_custom(std::function&lt;void(string, string&amp;, vector&lt;CustomObject&gt;&amp;)&gt; func, string filename, string&amp; lastline, vector&lt;CustomObject&gt;&amp; dict, unsigned int interval){
       std::thread([func, interval, filename, lastline, dict](){
           while (true){
               auto x = std::chrono::steady_clock::now() + std::chrono::milliseconds(interval);
               func(filename, lastline, dict);
               std::this_thread::sleep_until(x);
           }
       }).detach();
  }
  </code></pre>
  
  <p>however, right now the compiler compain : </p>
  
  <pre><code>No matching function for call to object of type 'const
  std::function&lt;void (string, string &amp;, vector&lt;RowData&gt; &amp;)&gt;' (aka
  'const function&lt;void (basic_string&lt;char, char_traits&lt;char&gt;, allocator&lt;char&gt; &gt;,
  basic_string&lt;char, char_traits&lt;char&gt;, allocator&lt;char&gt; &gt; &amp;, vector&lt;RowData&gt; &amp;)&gt;')
  </code></pre>
  
  <p>I know if a place the function in the same file, then i can skip the func as parameter, but i am still very curious and stubborn to know how to work this out, as i will call the <code>timer_start_custom</code> in different file and pass in different functions</p>