Oneofkind
Oneofkind

Reputation: 31

How to pass in parameters in C++?

I'm debugging this function that was declared with three params, but actually passed in two, is it allowed or maybe it didn't call it directly?

ConfigList filter(
        const BidRequest& br,
        const ExchangeConnector* conn,
        const ConfigSet& mask = ConfigSet(true));

Here is the calling:

auto biddableConfigs = filters.filter(*auction->request, exchangeConnector);

I tried to print out something inside the filter, it printed out one line and one name, not two lines before it.

What is wrong?

Thanks, Oneofkind

Upvotes: 0

Views: 49

Answers (1)

Mo Abdul-Hameed
Mo Abdul-Hameed

Reputation: 6110

It's OK to use it with 2 parameters only, the 3rd parameter in the function declaration is const ConfigSet& mask = ConfigSet(true), which means that it has a default value that will be used when you don't send the 3rd parameter.

Upvotes: 1

Related Questions