title: Lambda in constructor
body: <p>I have a class which uses lambda in one of its constructor, and I am having trouble understanding how it gets executed</p>
  
  <pre><code>using pred = std::function&lt;bool(int)&gt;;
  using pred_list = std::vector&lt;pred&gt;;
  
  class check
  {
      private:
          std::string const _description;
      public:
          check(std::string, msec duration = msec{0});
          check(std::string, pred_list, msec duration = msec{0});
          check(std::string, pred, msec duration = msec{0});
  };
  </code></pre>
  
  <p>The constructors</p>
  
  <pre><code>check::check(std::string d, pred_list p, msec dur)
  : _description{d}, _duration{dur}, _predicates{p}, _pred_pass{false}
  , _deadline{msec::max()}
  {};
  
  check::check(std::string d, pred p, msec dur)
  : _description{d}, _duration{dur}, _predicates{1,p}, _pred_pass(false)
  {};
  
  check::check(std::string s, msec dur)
  : check(s, [](int i) { return i &gt; 0; }, dur) 
  {};
  </code></pre>
  
  <p>Constructor in question</p>
  
  <pre><code>check::check(std::string s, msec dur)
  : check(s, [](int i) { return i &gt; 0; }, dur) 
  {};
  </code></pre>
  
  <p>If I create an object of type check using the following</p>
  
  <pre><code>check db_intl{"Test", db_dur};
  </code></pre>
  
  <p>The following constructor gets called</p>
  
  <pre><code>check::check(std::string s, msec dur)
  : check(s, [](int i) { return i &gt; 0; }, dur) 
  {};
  </code></pre>
  
  <p>How is this constructor able to call the other constructor with the lambda if that lambda is not being used?</p>