Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the second parameter mean in this signature?

Tags:

c++

vector

std::vector<int> interpret(const std::string &src, const std::vector<int> &input = {});

I understand everything about the signature except setting the reference input to {}. What does that mean?

like image 278
user3577756 Avatar asked Mar 15 '23 00:03

user3577756


1 Answers

The = introduces a default value for the parameter... {} in this case indicates an empty vector. Consequently, you can invoke the function with one argument, and input will be empty.

like image 116
Tony Delroy Avatar answered Mar 31 '23 13:03

Tony Delroy