I have a class which uses lambda in one of its constructor, and I am having trouble understanding how it gets executed
using pred = std::function<bool(int)>;
using pred_list = std::vector<pred>;
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});
};
The constructors
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 > 0; }, dur)
{};
Constructor in question
check::check(std::string s, msec dur)
: check(s, [](int i) { return i > 0; }, dur)
{};
If I create an object of type check using the following
check db_intl{"Test", db_dur};
The following constructor gets called
check::check(std::string s, msec dur)
: check(s, [](int i) { return i > 0; }, dur)
{};
How is this constructor able to call the other constructor with the lambda if that lambda is not being used?